jimwillsher 65 Posted January 11 Share Posted January 11 Hi all We use the Run Command tasks extensively, for running stuff on client machines (currently around 1000 endpoints). Examples are to download an MSI from a website and then a second task to run msiexec. Other examples are to pull values from the registry and email them back for diagnostics. Whilst the editor doesn't lend itself to powershell scripts that require multiple steps, with no option to edit them properly, it generally does work. But, what's the best way to return results from PowerShell? Because the task itself starts okay, the task execution history shows that the task executed, even if the powershell etc then failed. My current scenario is this. I am downloading an MSI as one task, installing it as another task by utilising msiexec and specifiying a log file, and then have a third task to email me back the log file. Which is all VERY clunky. Are there any viable alternative approaches? Sample Run Command line: powershell -Command "$secpasswd = ConvertTo-SecureString 'xxx' -AsPlainText -Force;$cred = New-Object System.Management.Automation.PSCredential ('xxx', $secpasswd);Invoke-WebRequest 'http://xxx/TeamViewer/xxx.mst' -OutFile 'C:\Windows\Temp\xxx.mst' -Credential $cred;Invoke-WebRequest 'http:/xxx/TeamViewer/TeamViewer_Host.msi' -OutFile 'C:\Windows\Temp\TeamViewer_Host.msi' -Credential $cred;msiexec /i 'C:\Windows\Temp\TeamViewer_Host.msi' ADDLOCAL="f.ProductFeature,f.ProgramMenuShortcut,f.ProgramMenuShortcut" TRANSFORMS='C:\Windows\Temp\xxx.mst' /qn /l*v 'C:\Windows\Temp\Jim.log'" Thanks Jim Quote Link to comment Share on other sites More sharing options...
jimwillsher 65 Posted January 23 Author Share Posted January 23 No takers? @Aryeh Goretsky @Marcos Quote Link to comment Share on other sites More sharing options...
Administrators Marcos 5,085 Posted January 24 Administrators Share Posted January 24 Unfortunately I'm not well versed in PowerShell. It's rather a question for PowerShell experts in the appropriate (probably MS) forum. Quote Link to comment Share on other sites More sharing options...
jimwillsher 65 Posted January 24 Author Share Posted January 24 No problem Marcos, I appreciate the honesty and the reply. Jim Quote Link to comment Share on other sites More sharing options...
ESET Moderators Aryeh Goretsky 379 Posted February 10 ESET Moderators Share Posted February 10 Hello, Just saw the mention. I will admit my PowerShell skills are pretty amateur, but since you are instantiating it from ESET PROTECT, I'm wondering if the "-command" argument is still needed. You might want to check with business support on this and see what they advise. Regards, Aryeh Goretsky Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.