First time on this forum. But it helped me out many times. Thank you all for that!
I have a question were I can’t seem to find an answer on.
For an automation project I am starting to run cmd.exe as a different user (shift+right, normally).
For that, I use a predefined string. For security reasons I would like to retrieve credentials from orchestrator. That part is working fine, since entering password as secure string is working great.
The string I want to use is: "runas /netonly /user:domain\" + RobotUsername.ToString + Chr(34) +"mmc %windir%\system32\dsa.msc"+ Chr(34)
That one is throwing an error at the start of the sequence with: reference not set to an object.
When I use the following without a variable: "runas /netonly /user:domain\RobotUsername" + Chr(34) +"mmc %windir%\system32\dsa.msc"+ Chr(34)
Everything is working great. I found out that the variable is not empty.
The string runs when I remove the “To.String” part, but obviously it’s empty then.
Does anybody bump into this before and can help me further?
Could you confirm again on the variables used for the Get Credential Activity and also try using a Write Line or Log Message Activity with .ToString suffixed and Check whether it gives out an Error.
Maybe also check in the Debug Panel what is the value of RobotUsername variable.
Here, we can see RobotUsername name is used as a variable
Here, the variable name is used as a literal and not the value of the variable RobotUsername
Let us know your findings after a Debug and check using Immediate Panel.
Here as per the screenshot RobotCredentials is the Asset name and can you confirm RobotUsername is the variable used inside the username field in Get credential activity??
Also plz cross check d credentials created in orchestrator.
Of course I tried to log the username as a debug method. It logs it perfectly, but it just doesn’t print it in the string of cmd. So
it’s not printing the username in the cmd command, but in the log message it does
adding To.String caused the flow not to run at all.
This rules out that orchestrator credentials are not right or any of these things. The variable is 100% coming in to the workflow and is saved in the variable which RobotUsername which is indeed used in the GetCredential activity.
@martijn.pirozzi
If that does not work, the only possible explanation to this, is that you have two variables named RobotUserName but in different scopes, and the one you’re using in your command line is empty. Please recheck the variables and their scopes and make sure the value is correctly passed in the right flow.