ImagePathcher.ps1: You cannot call a method on a null-valued expression

In my environments, I use MDT and/or WDS in many cases. Here is always the problem of updating images, because it takes a lot of time. For this reason, I was looking for a script, which would do the same work as I, but without losing my time.
Imagepatcher PowerShell script from CodePlex (http://imagepatcher.codeplex.com) was the perfect solution for me, but not in the last months. I think that the problem occurred after I upgraded my environment to Windows Server 2012, but I am not sure. Anyway, when I tried to execute the script, I received the error that there is something wrong with the saving of downloaded files. I analyzed the script and found that something is not working properly when combining the name from few variables.
I repaired the issue and you can download the new imagepatcher.ps1 from here.

imagepatcher.zip (36.63 kb).

Update Windows 8 and Windows Server 2012 with WSUS 3.0

Now many of us are using Windows 8 and Windows Server 2012. In many cases, there are some problems updating these operating systems with WSUS 3.0. The first symptom is, that these systems are reported in WSUS as Windows XP pro, not as Windows 8. It seems that the problem is in WSUS service. To solve the problem you must install WSUS SP2, which is downloadable from http://www.microsoft.com/en-za/download/details.aspx?id=30747 (64bit) or from http://www.microsoft.com/en-za/download/details.aspx?id=30748 (32bit).
After installing this update, you will be able to update the Windows 8 and Server 2012 operating systems..

Maintaining WSUS 3.0 with scripts

Every month we have more and more updates to download to our servers and the result is more and more space used. This is why we must frequently and automatically take care of our system.

To free some space with the deletion of unused and unneeded updates, exist on TechNet a script and you can automate this step using a scheduled task and a batch file. A sample of bat file is attached.

On TechNet is also available a script to maintain health status of the SUSDB database. As in previous suggestion, I recommend to execute this step with a scheduled task and a command like:
sqlcmd -S “SQL_Server/Instance” -E -i”<Location>Script.sql” -o “<Location>DB_Output.txt”
If you have a SBS server or another system, based on Windows internal database, the correct syntax is:
sqlcmd -S ” np:.pipeMSSQL$MICROSOFT##SSEEsqlquery ” -E -i”<Location>Script.sql” -o “<Location>DB_Output.txt”
This line will establish a trusted connection to SQL Server,execute the script and write all outputs to the DB_Output.txt file. Switches are case sensitive!

This operation will maintain your server in good conditions and always clear, without unneeded updates. I recommend to run this scripts every two or three months, it’s not necessary to run them more frequently.

CleanWSUS.bat (228.00 bytes).