Powershell dont work with scom 2007 r2
When i try to start powershell wih scom 2007 r2 it dont work.
The command i am running is:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile Microsoft.EnterpriseManagement.O
perationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManageme
nt.OperationsManager.ClientShell.Startup.ps1
The errors i am getting is:
WARNING: The following errors occurred when loading console C:\Program
Files\System Center Operations Manager
2007\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1:
Cannot load Windows PowerShell snap-in
Microsoft.EnterpriseManagement.OperationsManager.Client because of the
following error: Mandatory value ApplicationBase not specified for registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.
EnterpriseManagement.OperationsManager.Client.
Command '.\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.
ps1' could not be executed because some Windows PowerShell snap-ins did not load
Is there a way to fix this?
Morten
November 12th, 2010 7:46am
Hi
Can you clarify how you are running this. And on which machine? Is it the RMS? Does the Microsoft.EnterpriseManagement.OperationsManager.Client registry key exist in the location specified? If not, is the OpsMgr console installed? What Operating System?
I have fired up windows powershell and executed your command from c:\program files\system center operations manager 2007\ and it works fine for me so there isn't an underlying OpsMgr problem but something specific to your environment.
If you could provide more details we can help troubleshoot.
Cheers
Graham
View OpsMgr tips and tricks at
http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2010 8:47am
Hello
I am running it from the shorcut in the Start Menu, System Center Operations Manager 2007 R2\Operations Manager Shell
The info there is:
Target:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1
Start In:
"C:\Program Files\System Center Operations Manager 2007\"
I am running it from the RMS.
The key in registry is here:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.EnterpriseManagement.OperationsManager.Client]
OS is Windows 2003 server R2 SP2
Morten
November 14th, 2010 7:09am
Hi,
Please add the snapin and try again:
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
Meanwhile, I would like to share the following with you for your reference:
Have your PowerShell and our Cmdlets too...
http://blogs.msdn.com/b/scshell/archive/2007/01/03/have-your-powershell-and-our-cmdlets-too.aspx
Hope this helps.
Thanks.Nicholas Li - MSFT
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 15th, 2010 3:18am
Hello
When i Start Windows Powershell and try to add PSSnapin i get an error message:
PS C:\> Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
Add-PSSnapin : Mandatory value ApplicationBase not specified for registry key HKEY_LOCAL_MACHINE\Software\Micro
erShell\1\PowerShellSnapIns\Microsoft.EnterpriseManagement.OperationsManager.Client.
At line:1 char:13
+ Add-PSSnapin <<<< Microsoft.EnterpriseManagement.OperationsManager.Client
+ CategoryInfo : InvalidArgument: (Microsoft.Enter...sManager.Client:String) [Add-PSSnapin], PSArg
ception
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
If i start Windows Powershell and write cd OperationsManagerMonitoring::
i get an error message:
PS C:\> cd OperationsManagerMonitoring::
Set-Location : Cannot find a provider with the name 'OperationsManagerMonitoring'.
At line:1 char:3
+ cd <<<< OperationsManagerMonitoring::
+ CategoryInfo : ObjectNotFound: (OperationsManagerMonitoring:String) [Set-Location], ProviderNotF
eption
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
If i write New-PSDrive -Name: Monitoring -PSProvider: OperationsManagerMonitoring -Root: \ in powershell i also get a error message:
PS C:\> New-PSDrive -Name: Monitoring -PSProvider: OperationsManagerMonitoring -Root: \
New-PSDrive : Cannot find a provider with the name 'OperationsManagerMonitoring'.
At line:1 char:12
+ New-PSDrive <<<< -Name: Monitoring -PSProvider: OperationsManagerMonitoring -Root: \
+ CategoryInfo : ObjectNotFound: (OperationsManagerMonitoring:String) [New-PSDrive], ProviderNotFo
ption
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand
I am not an expert in powershell.
Morten
November 15th, 2010 4:08am
Hi,
Please also check the value “ApplicationBase” in the following Registry Key, is it set to the path of your System Center Operations Manager
2007?
HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.EnterpriseManagement.OperationsManager.Client
If not, please modify it to your System Center Operations Manager 2007’s installation path, such as “C:\Program Files\System Center Operations
Manager 2007\” (without quotations).
Hope this helps.
Thanks.
Nicholas Li - MSFT
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 16th, 2010 2:55am
Hello
In registry under Microsoft.EnterpriseManagement.OperationsManager.Client i created a type REG_SZ and ApplicationBase with Data C:\Program Files\System Center Operations Manager 2007
When i run powershell i still get a error:
PS C:\Program Files\System Center Operations Manager 2007> C:\WINDOWS\system32\w
indowspowershell\v1.0\powershell.exe -PSConsoleFile Microsoft.EnterpriseManageme
nt.OperationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseMana
gement.OperationsManager.ClientShell.Startup.ps1
WARNING: The following errors occurred when loading console C:\Program
Files\System Center Operations Manager
2007\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1:
Cannot load Windows PowerShell snap-in
Microsoft.EnterpriseManagement.OperationsManager.Client because of the
following error: Mandatory value AssemblyName not specified for registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.
EnterpriseManagement.OperationsManager.Client.
Command '.\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.
ps1' could not be executed because some Windows PowerShell snap-ins did not load
Morten
November 16th, 2010 6:04am
Hi,
At this time, also check the key AssemblyName under the key:
HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.EnterpriseManagement.OperationsManager.Client
I think the value should be "Microsoft.EnterpriseManagement.OperationsManager.ClientShell, Version=6.0.4900.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
I have also exported this key on my server, here is the content. Please also check other keys referring to this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.EnterpriseManagement.OperationsManager.Client]
"ApplicationBase"="C:\\Program Files\\System Center Operations Manager 2007\\"
"AssemblyName"="Microsoft.EnterpriseManagement.OperationsManager.ClientShell, Version=6.0.4900.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
"ModuleName"=" C:\\Program Files\\System Center Operations Manager 2007\\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.dll"
"PowerShellVersion"="1.0"
"Vendor"="Microsoft Corporation"
"Version"="6.0.4900.0"
"Description"="Microsoft Operations Manager Shell Snapin"
"Types"=" C:\\Program Files\\System Center Operations Manager 2007\\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Types.ps1xml"
"Formats"=" C:\\Program Files\\System Center Operations Manager 2007\\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Format.ps1xml"
Hope this helps.
Thanks.
Nicholas Li - MSFT
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 16th, 2010 9:15pm
Hello
Thanks for your help so far.
I see to be missing some keys in my registry.
I created a reg file and imported the keys you had.
I seem to be close a solution now but the error i am getting now is:
Windows PowerShell terminated with the following error:
Invalid directory on URL
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0> C:\WINDOWS\system32\windowspowers
____\v1.0\powershell.exe -PSConsoleFile Microsoft.EnterpriseManagement.Operation
sManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManagement.Opera
tionsManager.ClientShell.Console.psc1
Windows PowerShell terminated with the following error:
Invalid directory on URL.
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0>
Morten
November 17th, 2010 8:44am
Hi,
Thank you for your update.
I am glad to know the progress. Your time and efforts are highly appreciated.
I noticed that you have imported the key I provided. Please ensure your installation path is “C:\Program Files\System Center Operations Manager
2007\” (without quotations); if not, please modify it to the correct one in the key.
Regarding the error “Invalid directory on URL”, what I think is checking if the file “Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1”
exists and ensuring the path is right.
Please try again use the full path or absolute path for the file “Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1”.
Hope this helps.
Thanks.
Nicholas Li - MSFT
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 18th, 2010 2:42am
Still the same error when i use to full path C:\Program Files\System Center Operations Manager 2007
Windows PowerShell terminated with the following error:Invalid directory on URL.
Here is the command i use:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\WINDO
WS\system32\windowspowershell\v1.0\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1" -NoExit "C
:\Program Files\System Center Operations Manager 2007\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Start
up.ps1"
Windows PowerShell terminated with the following error:
Invalid directory on URL.
Scom is installed into C:\Program Files\System Center Operations Manager 2007
Morten
November 18th, 2010 8:11am
Hi,
As far as I know, the command is the target of Operations Manager Shell:
“C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile Microsoft.EnterpriseManagement.O
perationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManageme
nt.OperationsManager.ClientShell.Startup.ps1”
Please also check if you can open “Operations Manager Shell”.
In addition, please also try the method in the following post and see if it works:
Have your PowerShell and our Cmdlets too...
http://blogs.msdn.com/b/scshell/archive/2007/01/03/have-your-powershell-and-our-cmdlets-too.aspx
Hope this helps.
Thanks.
Nicholas Li - MSFT
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 18th, 2010 10:33pm
Hello
Sorry that i not have responded but i have been very busy.
I can not open Operations Manager Shell
This is the command i am using:
C:\Program Files\System Center Operations Manager 2007>C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe-PSConsoleFile Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1
Error i am getting:
Windows PowerShell terminated with the following error:Invalid directory on URL.
If i try the commans in the link you sent me
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0> cd OperationsManagerMonitoring::
Set-Location : Cannot find a provider with the name 'OperationsManagerMonitoring'.At line:1 char:3+ cd <<<< OperationsManagerMonitoring::
+ CategoryInfo : ObjectNotFound: (OperationsManagerMonitoring:String) [Set-Location], ProviderNotFoundException+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Can i repair powershell or Scom to get this to work?
Morten
November 29th, 2010 8:23am
Hi,
Thank you for your update.
At this time, please check if other commands work, such as “get-date”, it will returns the current date and time.
I also suspect the Operations Manager Shell might be corrupted. Please try repairing the System Center Operations Manager console and see if it works.
Thanks.
Nicholas Li - MSFT
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 29th, 2010 9:55pm