I do appreciate this tip, as I was testing the script occasionally on my local machine, but the script is designed to run in a Server 2012 (R2) environment. I will definitely stop testing it on my local machine knowing that is a bad test locally... To be honest I'm not sure if my question was posted from my machine or the environment it will be utilized in, so I apologize and appreciate the thoroughness of your response.
But I am still curious about running powershell scripts here. I think I found a way, using comspec/wmic... but then I get 0 feedback unless the command is run locally.
Code: Select all
Run, %comspec% /k wmic /node:"%line%" process call create 'powershell.exe -NoExit -Command Add-WindowsFeature -IncludeAllSubFeature SNMP-WMI-Provider'
But this does not:
Code: Select all
Run, powershell.exe -NoExit -ComputerName %line% -Command Add-WindowsFeature -IncludeAllSubFeature SNMP-WMI-Provider
Basically I am trying to run powershell cmdlets on remote machines, and provide the stdout to the user if they require it. The comspec method does seem to work finally, but of course I get nothing on the machine for feedback this way.
What seems to be the source of the problem is this -ComputerName part, I found I can run most of it locally (Get-Hotfix at least works locally...) So perhaps the more specific question, how do I run these powershell cmdlets against remote machines...
I suppose in the short term I can continue to use comspec and wmic, but I would much prefer to use powershell directly - so I can provide the stdout to the end-user easily if needed (and actually have it be useful).