Get-Hotfixes.ps1 v1.4 [7 November 2008]

This script uses Get-ExchangeServer to generate a list of  servers and will enumerate the Exchange Patch information and list the windows updates installed on the server.

 This update changes the way the server list is generated and added the ability to check cluster nodes

COMMANDLINE OPTIONS
-EMAIL ………. Send an Email
-Localhost …… Test the server the script is running on
-CLUSTER …….. Autoenumerate Exchange Cluster nodes and adds to the Server list
-DAYS (No Days).. Report on recent changes

schtasks

I mentioned this before as a way to script adding tasks to a server.  So I came across an issue the other day, where I ran it once, but then it failed on the second time:

ERROR: Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

It turns out that schtasks create a mapping to ipc$ on the server, and in some cases doesn’t clear it when the command has completed.

So the easy fix is to unmap it and try again!

So here is the code I use to script test-exchange.cmd that fires off test-exchange.ps1 that I will post next week

$TaskUser = Read-Host “Account DomainAccount “

$TaskPswd = Read-Host “Account Password”

$TaskName = “Test-Exchange”

$ServerName = Hostname

Net use \$ServerNameIPC$ /delete

schtasks /create /s \$ServerName  /tn $TaskName /tr C:PSTest-Exchange.cmd /sc MINUTE /mo 10 /du 0023:55 /u $TaskUser /P $TaskPswd

schtasks /run /s \$ServerName  /tn $TaskName

schtasks /query