Updating a server with PowerShell

Usually servers are updated when no one is using them. This is normally the middle of the night and outside of backup windows. Instead of staying up all night to apply patches The following script also works.