Subscribe

What is the best way to run a command as a specific user

I'm calling a workflow from rest.  (From VMware VCO)   When I call the workflow from the WFA portal,  the powershell is executed as the user who is running the service.  When I run the workflow via a REST call, I get errors.

 

re Permissions - BASE] ### Command 'Grant Share Permissions - BASE' ###
13:58:32.148 ERROR  [Grant Share Permissions - BASE] Command failed for Workflow 'Create a Clustered Data ONTAP Qtree CIFS Share - mszafran' with error : \\SVM_MSZAFRAN\qtreevco2: Access is denied.
13:58:32.152 INFO  [Grant Share Permissions - BASE] ***** Workflow Execution Failed *****

 

Here are the offending commands:


icacls \\$NetbiosServer\$ShareName /grant $DomainName\"$RWGroupName":"(OI)(CI)M"    
icacls \\$NetbiosServer\$ShareName /grant $DomainName\"$ROGroupName":"(OI)(CI)RX"
icacls \\$NetbiosServer\$ShareName /remove "Everyone"

 

 

What is best to do here?    Is there a powershell equivalent of sudo or something that is spiffy for this?

Re: What is the best way to run a command as a specific user

Lesson Learned:   Make sure all the variables you want to get from the user that you need for the workflow to complete are marked mandatory.   I had a typo in one of the my really long and descriptive variable names.