遇到的一個SCOM怪問題,雖然解決可是不知道爲何

最近SCOM的主機升級OS到windows server 2012 r2 , 以前經過調用Powershell來使用webservice發送短信的腳本老是報錯。web

PSMessageDetails : Exception : System.IO.FileNotFoundException: 未能加載文件或程序集「file:///C:\ Windows\TEMP\2alyptoa.dll」或它的某一個依賴項。系統找不到指定的文件。 文件名:「file:///C:\Windows\TEMP\2alyptoa.dll」 在 System.Reflection.RuntimeAssembly._nLoad(AssemblyN ame fileName, String codeBase, Evidence assemblySecurit y, RuntimeAssembly locationHint, StackCrawlMark& stackM ark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFoun d, Boolean forIntrospection, Boolean suppressSecurityCh ecks) 在 System.Reflection.RuntimeAssembly.InternalLoadAsse mblyName(AssemblyName assemblyRef, Evidence assemblySec urity, RuntimeAssembly reqAssembly, StackCrawlMark& sta ckMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotF ound, Boolean forIntrospection, Boolean suppressSecurit yChecks) 在 System.Reflection.Assembly.Load(AssemblyName assem blyRef, Evidence assemblySecurity) 在 System.CodeDom.Compiler.CompilerResults.get_Compil edAssembly() 在 Microsoft.PowerShell.Commands.NewWebServiceProxy.G enerateWebServiceProxyAssembly(String NameSpace, String ClassName) 在 Microsoft.PowerShell.Commands.NewWebServiceProxy.B eginProcessing() 在 System.Management.Automation.Cmdlet.DoBeginProcess ing() 在 System.Management.Automation.CommandProcessorBase. DoBegin() 警告: 程序集綁定日誌記錄被關閉。 要啓用程序集綁定失敗日誌記錄,請將註冊表值 [HKLM\Software\Microsoft\Fusion!E nableLog] (DWORD)設置爲 1。 注意: 會有一些與程序集綁定失敗日誌記錄關聯的性能損失。 要關閉此功能,請移除註冊表值 [HKLM\Software\Microsoft\Fusion!EnableLo g]。 TargetObject : CategoryInfo : NotSpecified: (:) [New-WebServiceProxy], FileNotFoundEx ception FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Co mmands.NewWebServiceProxy ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : 在 send-smsMessage、C:\Scripts\SendSmsByAlertCustomSettin g.ps1 中: 第 98 行 在 、C:\Scripts\SendSmsByAlertCustomSetting. ps1 中: 第 127 行 PipelineIterationInfo : {} shell

這個錯誤和New-WebServiceProxy 有關係,關鍵是我登錄SCOM的notification 帳號下,運行腳本測試,又不會報錯。 windows

而後我修改了SCOM 的notification Account 爲另一個帳號,而後重啓了下SCOM主機,結果又不會報錯了,惟一的不一樣是新的這個帳號在administrators組,而以前的帳號只是一個普通的user. ide

找到不一樣後,我把舊的SCOM nofication account 加入到administrators 組,重啓SCOM 主機,而後測試了下告警短信,腳本執行也不報錯。 性能

另外看了下c:\windows\TEMP\目錄的權限,這個目錄普通用戶只能建立目錄和文件,本身建立的文件纔有權限,難道和這個有關係? 仔細思考下,以爲也不該該,爲什麼沒有加入administrators組時,手動執行腳本也不報錯呢,恰恰由SCOM腳本訂閱時執行命令就會報錯。 測試

這個問題先放在這裏,後續再看看…. 日誌

相關文章
相關標籤/搜索