I’ve been doing some thinking about PowerShell Remoting for a project at work and realized that I hadn’t ever set up remoting on my “home” laptop. I’m not in a domain, so remoting configuration is a bit different. In any case, I would be using the same machine as source and target of the remoting call, so how could it go wrong?
First of all, VMWare had set up some network adapters and placed them in a public profile. Enable-PSRemoting doesn’t like that. It was an easy google (bing?) to fix and Enable-PSRemoting succeeded.
I then issued this:
invoke-command -scriptblock { get-process | select-object -first 10 } -computer localhost
Imagine my surprise when the result was this:
Could not find file 'C:\Windows\System32\WindowsPowerShell\v1.0\Event.Format.ps1xml'. + CategoryInfo : OpenError: (:) [], RemoteException + FullyQualifiedErrorId : PSSessionStateBroken
I searched the internet for this, but only found one hit that was close, and that was a bug report for nuget.
It seems like the powershell engine that is running the remote payload is looking for a formatting file that doesn’t exist. To work around this, I simply copied an existing Format.ps1xml file (I chose Registry.format.ps1xml because it was the smallest), removed the signature from it, and changed the name of the view (so it wouldn’t change any output).
It’s not a big bug, and it’s a beta so I’m not worried. Just thought I’d share my workaround.
-Mike