Powershell script in jenkins is hanging
I'm guessing that your PowerShell script is hanging because of the Invoke-Command command. My best guess is PowerShell is either prompting you for something, you are passing in an argument incorrectly, or you are executing the script in your script block incorrectly. I'm not sure exactly how Script-Block works when referencing paths to PowerShell scripts, but it could be because C:\hg\Update.ps1 does not exist on the remote server. It could also be because of the commands in your "C:\hg\Update.ps1" script. Some debugging tips that I recommend:


Remove your Invoke-Command line and see if the program executes.
Replace the ScriptBlock command with a simpler command, like Get-Culture, command and see if it still hangs. 
Replace your C:\hg\Update.ps1 with another script that performs a simple command.
If all of those options still hang, try using the simple script method, but with different args. 


And of course as with all PowerShell remoting issues, you should check that your firewall and network settings on the remote server allow connections from Jenkins over ports 5985 and 5986.