VMware Cloud Community
chicagovm
Enthusiast
Enthusiast

PowerShell - Invoking an external script with multiple $servers

Greetings..

I am really enjoying vCO 5.5.2. Yet, still hard to figure out certain non vCenter API workflows etc..

If I would like to run the script listed below - which would remove SCOM 2012 agent from multiple servers, which is the best way to create the workflow so it prompts me for the servers I would like to run the "working" PS scripts again.


PS host is in tact and does one-liners via Invoke an external script from the PowerShell library..but I'm not sure I understand how to call a script to either a txt file with multiple servers or would I develop a workflow which for prompt me for the $servernames like the attached screen shot.. Is the "Arguements" field where one inputs the $servernames ?

The script I am trying to call, which does work locally from the server is -

FROM A SERVER OTHER THAN THE SERVER WITH THE AGENT INSTALLED - (provide name of server with agent to remove)

Invoke-Command -ComputerName XXXSERVER01 -Command {Import-Module 'C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager'; 'C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager\Functions.ps1'; 'C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager\Startup.ps1'; Get-SCOMAgent -DNSHostName %FQDN_OF_SERVER_TO_UNINSTALL% | Uninstall-SCOMAgent}

Please help me understand if you can and move forward.


Thank you..

0 Kudos
1 Reply
chicagovm
Enthusiast
Enthusiast

Anyone assist?

Basically I am trying to call a PowerShell script to prompt me with the $servernaame I am trying to run the script against.. Any ideas?

0 Kudos