VMware Workspace ONE Community
RikkStreng
Contributor
Contributor

Can I run Powershell commands directly out of the Files/Actions ' Run' command?

(1908 cloud instance) - We have a particular Powershell code we want to push to user's Windows machines to create an account.  We currently push this as a script.ps1 file to the user's computer, which runs and then is followed by a Delete Files command.  This code has a password in it we need to keep secret.  Since it's a very short script I wanted to try pushing the code directly as a ' Run'  in Files/Actions tied to a product (to avoid any ps1 file ever being on the device).  However, whatever I try to do, it keeps telling me ' Source file is not present.'   I've tried doing the straight command (which is basically an 'if (account isn't there) {create account}' ) and I've also tried running powershell.exe -Command ' blahblah'  with powershell.exe's full path.  The command works in a Powershell session and from the Windows Run box, so I know it works.  Just not sure how to format it for Airwatch to ' Run'  it.
Labels (1)
Reply
0 Kudos
4 Replies
Stansfield
Enthusiast
Enthusiast

The code is being run as admin by the workspace agent is there a reason you need a password in the script instead of just using the admin rights it runs the script with?
Reply
0 Kudos
RikkStreng
Contributor
Contributor

The code we are using creates the user and assigns a password to it.  This is to be a local user account on the computer.
Reply
0 Kudos
KrisHornsleth
Enthusiast
Enthusiast

I do the same thing and am currently using a PS1 script file.  I imagine there's a way to do it all on the command line, but you may run into character limit on the command line.  I never tried myself since my script is lengthy.  It's likely a path problem.  I believe it needs to use the 32bit powershell.exe.  What did you try?
Reply
0 Kudos
phongshader
Contributor
Contributor

Did you ever get an answer to this? I'm running into the same issue. I'm trying to run this from Files/Actions ' Run' command:

msiexec.exe /i C:\Windows\Temp\splunk\splunkforwarder-8.0.6-152fb4b2bb96-x64-release.msi RECEIVING_INDEXER="blahblahblah" WINEVENTLOG_SEC_ENABLE=1 WINEVENTLOG_SYS_ENABLE=1 MONITOR_PATH="C:\Program Files\osquery\logs\osqueryd.results.log" MONITOR_PATH="C:\ProgramData\Airwatch\UnifiedAgent\logs\" AGREETOLICENSE=Yes /quiet

and end up with this:

Screen Shot 2020-10-19 at 4.45.59 PM.png

I had been running a batch file to run the ps1 file from Files/Actions ' Run' command but for some reason I started getting this error:

splunkmsiexec.PNG

so I tried running it from cmd line.

Reply
0 Kudos