The case of the PSRemotingTransportException

 

 The case of the PSRemotingTransportException

I have a SCVMM 2008 R2\Hyper-V farm in which we use Powershell to automate provisioning of virtual machines. All of the servers are Windows Server 2008 R2. During our deployment process I encountered a failure and this of course sparked my interest to investigate further for root cause. The script includes a command to remotely invoke a command executed on a Hyper-V server. In our environment, we have many volumes so to ease Administration we rename the volume label to match the customer VM for identification. Therefore, we can correlate from a storage perspective which VMs reside on a particular volume from disk management for example.

At any rate, the command should rename the volume label.

Invoke-Command -ComputerName $hostname -ScriptBlock {param($f, $e)cmd /c label /MP $f $e} -ArgumentList $accesspath, $vmname

[Error]

The WSMan service could not launch a host process to process the given request. Make sure the WSMan provider host server and proxy are properly registered. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo: OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken

I found this puzzling since the server had been in production for almost two years without issue. I executed the same command from my desktop without error. I then executed the command from the same server from where the exception took place, still the command succeeded. I took a look at the Windows Event Viewer and a few errors regarding with user profiles. The event log named the profile owner as my service account that our automation depends.

[Application Event Log]

Event 1530 Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.

I logged server via RDP with my account and noticed that the profile for the service account had a status of “Backup” where it should say “Local”. This can occur when a profile cannot be loaded and a temporary profile is used instead. I deleted the user profile from User Profiles and logged off and then successfully established a remote desktop session with the service account as before this was not possible. I found that new profile in a desired state “Local”. I issued the same command to rename the volume label using the service account and it succeeded using the service account!!

 Finally, I deployed some VMs using our automating and all Powershell tasks executed successfully. I wanted to share this in the event that someone else encountered this issue as its quite odd and the solution had no impact on customer’s or their running VMs. The root cause was either a corrupt user profile or that profile was locked in use by another process.

Dave Guenthner [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights.