OM PowerShell Comdlet Error
2010-10-17 14:44 络绎 阅读(373) 评论(0) 收藏 举报(一)问题出现之前的操作
step1: 安装最新版的OM;
step2: 从daily update中获得最新的几个dll,并拷贝之,Dll list如下:
Microsoft.EnterpriseManagement.Core.dll
Microsoft.EnterpriseManagement.OperationsManager.dll
Microsoft.EnterpriseManagement.Runtime.dll
Microsoft.SystemCenter.CrossPlatform.ClientActions.dll
Microsoft.SystemCenter.CrossPlatform.ClientLibrary.ClientTasks.dll
Microsoft.SystemCenter.CrossPlatform.ClientLibrary.Common.dll
Microsoft.SystemCenter.CrossPlatform.ClientLibrary.MPAbstractions.dll
Microsoft.SystemCenter.CrossPlatform.ClientLibrary.WorkflowActivities.dll
Microsoft.SystemCenter.CrossPlatform.ClientLibrary.Workflows.dll
Microsoft.SystemCenter.CrossPlatform.PowerShell.dll
step3: 将这些dll copy到OM2012目录下的server目录之下,再将前三个dll再copy到server目录的子文件夹SDK Binaries中进行覆盖;
此时,OM算是安装完毕,可打开Consloe server进行简单的操作测试,如import MP, create account, discovery server machine等。
step4: 安装PowerShell dll,具体操作分机器进行——
1)64位机,运行
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe “C:\Program Files\System Center Operations Manager 2012\Server\Microsoft.SystemCenter.Crossplatform.Powershell.dll”
2)32位机,运行
C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe “C:\Program Files\System Center Operations Manager 2012\Server\Microsoft.SystemCenter.Crossplatform.Powershell.dll”
注意: 若是之前已经安装了powershell.dll,则需要先将之前的版本进行卸载再安装。
至此,整个OM的PowerShell Comdlet配置结束,可进行测试了。
(二)测试命令及问题
测试命令如下:
1)Add-PSSnapin SCXOMCLientshell,运行后提示
...Can not load file or assmembly 'Microsoft.SystemCenter.Core.Commands, Version=7.0.5000.0, Culture=neutral...' or one of its dependencies...
2)Get-Help *SCX*, 运行指令,PowerShell没反应
P.S windows 2K8还真不习惯,截图这些什么都没有,又不能装其他软件,想截个图都无法;另外我查了本机的Microsoft.SystemCenter.Core.Commands.dll,其版本号是7.0.7768.0,因此我怀疑是这个dll版本号的原因,不过还不是很确定,需要去其他的server上查看下看能不能拷贝到7.0.5000.0的版本。
(三)解决方法
其实问题的本质我并没有了解,甚至解决的原因我也不清楚,不过既然问题解决了,我还是说下解决的方法:
出现问题时使用的脚本code如下:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u "C:\Program Files\System Center Operations Manager 2012\Server\Microsoft.SystemCenter.Crossplatform.Powershell.dll"
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe "C:\Program Files\System Center Operations Manager 2012\Server\Microsoft.SystemCenter.Crossplatform.Powershell.dll"
# If cannot work, enable this.
#.\import-modules.ps1
get-pssnapin -registered
Add-PSSnapin SCXOMCLientshell
Add-PSSnapin [Microsoft.SystemCenter.CrossPlatform.PowerShell]::SCXOMCLientshell
get-command -module Scxomclientshell
get-command -module Microsoft.SystemCenter.CrossPlatform.PowerShell
将这个脚本做如下更改:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u "C:\Program Files\System Center Operations Manager 2012\Server\Microsoft.SystemCenter.Crossplatform.Powershell.dll"
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe "C:\Program Files\System Center Operations Manager 2012\Server\Microsoft.SystemCenter.Crossplatform.Powershell.dll"
get-pssnapin -registered
Add-PSSnapin SCXOMCLientshell
Add-PSSnapin [Microsoft.SystemCenter.CrossPlatform.PowerShell]::SCXOMCLientshell
get-command -module Scxomclientshell
get-command -module Microsoft.SystemCenter.CrossPlatform.PowerShell
这样就解决了之前出现的问题。
除了两个注释语句之外,并无做任何改变。继续纠结中...
浙公网安备 33010602011771号