Remote Installing With Powershell linked to Citrix Scheduled Reboot

We had to find a way to install package (hotfix or msi ) on our servers juste before the Citrix scheduled reboot, as we try to limit the effects on our users. We also want the script to be the most multi-purpose, then we decided to put all applicable actions in an xml file (action_list.xml) with the following syntax :

	<action name="action1">
		<script>c:\windows\system32\msiexec.exe /i c:\tmp\file1.msi /l*v c:\tmp\file1.log /quiet /norestart</script>
		<clean>=== Verbose logging stopped:</clean>
	<action name="actionx">
		<script>c:\tmp\filex.exe log:c:\tmp\filex.log /norestart</script>

In a CSV file, we store Citrix folders and the required actions


Finally, we prefered to make the choice of a dynamically declared variables to store actions rather than insert them into an hashtable, the script is more brief and lisible.
A variable is initialized with the cmdlet New-Variable

PS>New-Variable -Name Toto -Value titi

We can access to its content with the cmdlet get-variable

PS > get-variable -Name toto

Name                           Value
----                           -----
toto                           titi

PS > get-variable -Name toto -valueonly

Here come the full script

Leave a Reply

Your email address will not be published. Required fields are marked *