08-21-2013 06:59 AM - edited 03-01-2019 09:03 AM
I'm looking to get Multiple Windows server rebooted using PowerShell script in Tidal. Does anyone know how to use global variable using multiple servers. ?? Any Help would be appreciated.
Solved! Go to Solution.
08-21-2013 08:34 AM
Sounds like you are looking to do some automation surrounding microsoft patching or something like that.
I would not go about it with a global variable... I think there may be a character limitation on a var value.
Powershell is pretty powerfull and can easily do the task, you can get as fancy as you want... Tidal can take mulitple powershell
statements. We often do this and leverage exit codes for different scenarios. using multiple ifs.
if (condition met) {Do this} else {Do Else} ; Exit(###);
Then Tidal takes action based on exit code (alert, send email, etc)
From a Tidal/Powershell perspective you need to consider a few things
Security ... the runtime user needs access to all servers in the list in order to execute a shutdown or you pass it credentials.
Tidal Agent config
Powershell commands can have issues with double quotes in params depending on how its used... so we avoid and each agent tagent.ini has this config switch
[config]
substticks=n
Target Servers may need same version of powershell as agents and have their execution policys set properly (depending on technique used)
Active Directory you may be organized to take advantage of server names
Workflow/Design
AD
You could have Tidal Powershell get a list from AD, generate a list, then reboot for each object..
List
Another Simple way would be to use powershell to determine the list based on critera or supply it a list. The simple way is something like this
restart-computer (get-content \\SomeNetworkShare\MS_PatchWeekend_ServerReboot_List.txt) ;
Tidal Groups with Group variables
Ad-Hoc
Maybe you want to be able to reboot servers ad-hoc so you could create a template that takes a group variable and passes that server name to the powershell restart-computer cmdlet.
Patch Weekend job group
Depending on size of the environment you could have a job set that is "scheduled" on patch weekends that is made up of mulitple template groups that leverage job name to pass server name to the powershell restart-computer cmdlet (jobname=servername). You could also have some sort of secondary powershell statement or second job that lets you know when server is back up...
Other
Here's a case where it finds servers to reboot and there are many examples on the internet to borrow and learn from.
Hope this helps!
Marc
08-21-2013 08:34 AM
Sounds like you are looking to do some automation surrounding microsoft patching or something like that.
I would not go about it with a global variable... I think there may be a character limitation on a var value.
Powershell is pretty powerfull and can easily do the task, you can get as fancy as you want... Tidal can take mulitple powershell
statements. We often do this and leverage exit codes for different scenarios. using multiple ifs.
if (condition met) {Do this} else {Do Else} ; Exit(###);
Then Tidal takes action based on exit code (alert, send email, etc)
From a Tidal/Powershell perspective you need to consider a few things
Security ... the runtime user needs access to all servers in the list in order to execute a shutdown or you pass it credentials.
Tidal Agent config
Powershell commands can have issues with double quotes in params depending on how its used... so we avoid and each agent tagent.ini has this config switch
[config]
substticks=n
Target Servers may need same version of powershell as agents and have their execution policys set properly (depending on technique used)
Active Directory you may be organized to take advantage of server names
Workflow/Design
AD
You could have Tidal Powershell get a list from AD, generate a list, then reboot for each object..
List
Another Simple way would be to use powershell to determine the list based on critera or supply it a list. The simple way is something like this
restart-computer (get-content \\SomeNetworkShare\MS_PatchWeekend_ServerReboot_List.txt) ;
Tidal Groups with Group variables
Ad-Hoc
Maybe you want to be able to reboot servers ad-hoc so you could create a template that takes a group variable and passes that server name to the powershell restart-computer cmdlet.
Patch Weekend job group
Depending on size of the environment you could have a job set that is "scheduled" on patch weekends that is made up of mulitple template groups that leverage job name to pass server name to the powershell restart-computer cmdlet (jobname=servername). You could also have some sort of secondary powershell statement or second job that lets you know when server is back up...
Other
Here's a case where it finds servers to reboot and there are many examples on the internet to borrow and learn from.
Hope this helps!
Marc
08-22-2013 07:12 AM
Thanks Marc.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: