2017-02-28 37 views
0

戻るWindows 7にPowershellの下位バージョンを使用した場合、次のコードは問題なく動作します。Get-ServiceのPowershellエラー

テキストファイルの各サーバーでサービスがいくつかチェックされ、結果がCSVにダンプされます。

今、私は、Windows 10上だとPowerShellを使用し、私はこのエラーメッセージを取得v5のこと:ここで

Get-Service : Cannot open Service Control Manager on computer 'tfsserver1'. This operation might require other privileges. At 
C:\Users\Razon\Desktop\Patching\ServerServices_Checker_v2.ps1:48 
char:4 
+   (Get-Service -Name TFSJobAgent*,IIS*,World* -ComputerName $_) | Select Machine ... 
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [Get-Service], InvalidOperationException 
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetServiceCommand 
####System Varialbe to User's Deskotp 
$filePath = [Environment]::GetFolderPath("Desktop") 

コードは次のとおりです。

​​
+1

リモートサーバーでPSRemotingが有効になっていますか? TrustedHostsに追加しましたか? –

答えて

0

解決するにはこの問題は、サーバー上のService Control Managerにアクセスできるようにユーザーのネットワーク権限を昇格させます。

https://support.microsoft.com/en-in/help/964206/cannot-open-service-control-manager-on-computer-servername-.-this-operation-might-require-other-privileges

+0

これはこれではありません。 ISE Run as AdminまたはPowerShell for Adminでは、エラーなしで何度か動作します。 – LordRazon

+0

これはどのように行われているのですか?記事には多くの情報がありません。 – KERR