This project is read-only.

Unhandled Exception

Aug 8, 2013 at 3:55 PM
I am able to create the exe but it will not execute, this is the error;

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly System.Management.Automation, Version=, Culture=neutral, PublicKey Token=31bf3856ad364e35 or one of its dependencies. The system cannot find the file specified.
 at ik.PowerShell.PS2EXE.Main(String[] args)
This is the ps1;

Set-Location C:\windows\system32\wbem\repository
Set-Service -Name tmlisten -StartupType Disabled
Stop-Process -Name TmListen -Force
Wait-Event -SourceIdentifier "Service Control Manager" -Timeout 5
Stop-Service -Name Winmgmt -Force
Get-ChildItem * -Recurse | Remove-Item -Force
Start-Service -Name Winmgmt
Set-Service -Name tmlisten -StartupType Automatic

Any help is appreciated.

Dec 16, 2016 at 10:23 PM
Had same issue.. just figured it out.

Check powershell version (run 'Host' on ps). Error only occurs on Version 2.0.
Compile with -runtime20

hope this helps!