Jump to content

Powershell: "An error occurred when loading the system Windows PowerShell Snap-Ins."


sjkittle

Recommended Posts

Dear All,

 

I'm having some trouble trying to run Windows Powershell commands via PC Monitor (Android App).  When I send any command, I get back the following message:

 

"An error occurred when loading the system Windows PowerShell Snap-Ins.  Please contact Microsoft Support Services."

 

This is displayed in the PowerShell terminal window inside the PC Monitor app.

 

Has anyone seen this problem before?  Or have any ideas how to fix it?

 

I'm running:

- one Windows Vista Home Premium SP2 machine.

- one Windows 7 Starter machine.

 

I get exactly the same error message when attempting to send commands to both machines.  They both have the .NET framework that came with the install, I've not installed any additions, or any new version of PowerShell.  Indeed, the Windows 7 machine is quite new and has few bits of third-party software installed on it.

 

In addition, I run PowerShell scripts from the desktop on both machines without any problems, and with users that are not admins.  I've never seen anything like this message on the desktop.

 

Any help would be greatly appreciated.  Google has turned up a few things, and I've attempted some of the solutions but with no joy.

 

Simon

 

 

 

 

 

 

Link to comment
Share on other sites

  • Administrators

Hello Simon,

 

The error is kind of vague so let's try to see what's going on.

 

  • Go to: C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell note down the subfolder names and let me know if inside each folder there is a file called: System.Management.Automation.dll like this:

 

v1.0 - Dll file exists

3.0 - Dll file exists

 

  • Open PC Monitor Manager.
  • Go to Settings tab.
  • Go to Diagnostics subtab.
  • Make sure that diagnostic logging is enabled by clicking the Enable Diagnostic Logging button (Click Yes on the warning that shows).
  • Apply your changes.
  • Take your mobile device, open PC Monitor, go to the PC you enabled diagnostic logging and try running Power Shell again.
  • You will notice again the error but inside the PC Monitor's installation folder you will find a file called trace.log .
  • Open up the log file and copy and past it's contents here in a reply (please remove any personal information that the log may contain).
  • Turn off diagnostic logging in PC Monitor Manager and save your changes.

 

Happy Holidays,

Paul.

Link to comment
Share on other sites

Hey, 

 

Thanks for your reply.

 

Okay, so, firstly I have no C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell directory.  I have C:\Program Files\Reference Assemblies\Microsoft, with only one subdirectory, called Framework, and with no System.Management.Automation.dll to be found at all.

 

There are three copies of System.Management.Automation.dll on my machine, one in the PC Monitor directory, one in a sub-directory of C:\windows\assembly and one in c:\windows\winsxs.

 

Opening up the trace.log file, it contains one line, which is as follows:

 

 

20/12/2012, 22:04:57.212: [service] Received Request Run PowerShell command 'ls' from device Id: 'a4f38f4908c67b6'
 
There are no errors in there at all; I've run several commands to be sure.
 
Link to comment
Share on other sites

Try a manual install of powershell on that machine.

 

Yeah, I tried that yesterday, just in case I was missing something.  But if I try to install the standard package of Powershell 2.0, the installer says "This update does not apply to your system," which seems quite sensible, given that Powershell 2 is already installed.

 

I thought about trying Powershell 3, but it's not available for Vista SP2.

 

It seems crazy that this doesn't work just because I'm using the version of Powershell which comes with Vista.

Link to comment
Share on other sites

  • Administrators

I'm not so sure about Powershell being installed. If you run powershell from cmd will it start?

 

Also please run this in powershell and let me know the output:

 

echo ([PSObject].Assembly.Location)

You can also try moving away from PC Monitor's installation folder the System.Management.Automation.dll which will force PC Monitor to use the one in your GAC.

 

If this doesn't fix let me know what operating system type you got (x64 or x86) and what type of installer you used for PC Monitor (x32 or x64).

 

Hope this helps.

Link to comment
Share on other sites

I'm not so sure about Powershell being installed. If you run powershell from cmd will it start?

 

Also please run this in powershell and let me know the output:

 

echo ([PSObject].Assembly.Location)

You can also try moving away from PC Monitor's installation folder the System.Management.Automation.dll which will force PC Monitor to use the one in your GAC.

 

If this doesn't fix let me know what operating system type you got (x64 or x86) and what type of installer you used for PC Monitor (x32 or x64).

 

Hope this helps.

 

Powershell is definitely installed, and working correctly.

 

The output of your command: 

 

C:\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll

 

 

Anyway.  I managed to uninstall Powershell 2 which was packaged with Vista (and I said, was working perfectly).

 

I then found that the full Windows Management Framework package would not install; I still receive the "Package not applicable" prompt.

 

So I installed Powershell 1, which is now on my system and working correctly.

 

But I still get the problem.  What's more, I still can't install Powershell 2.  So I've got a downgraded Powershell installation (which includes losing the ISE), and still no joy :(  Oh well.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...