"powershell has stopped working" on PS exit after creating IIS User
- by Nick Jones
On a Windows Server 2012 box, I'm using PS to create a new IIS User (for automated deployments using MSDeploy). The command itself appears to work fine -- the user is created -- but as soon as I exit my PowerShell session (typing exit or just closing the command window), a dialog is displayed stating "powershell has stopped working", with the following details:
Problem signature:
Problem Event Name: PowerShell
NameOfExe: powershell.exe
FileVersionOfSystemManagementAutomation: 6.2.9200.16628
InnermostExceptionType: Runtime.InteropServices.InvalidComObject
OutermostExceptionType: Runtime.InteropServices.InvalidComObject
DeepestPowerShellFrame: unknown
DeepestFrame: System.StubHelpers.StubHelpers.GetCOMIPFromRCW
ThreadName: unknown
OS Version: 6.2.9200.2.0.0.400.8
Locale ID: 1033
The PS commands in question are:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Management")
[Microsoft.Web.Management.Server.ManagementAuthentication]::CreateUser("Foo", "Bar")
Why is this happening and how can I avoid it?
EDIT: I've also confirmed this be a problem with PowerShell 4.0, so I've added that tag. I've also submitted it on Connect.
UPDATE: It appears that Windows Server 2012 R2 does not have this same bug.