0

現在、PoSH サーバーを使用して、サーバーで小さな統計アプリケーション (amdin の使用のみ) をホストしています。

SQL Server 2014 Management Studio のインストール後、PoSh サーバーは次のエラーで起動を拒否しました。

警告 : PoSH サーバー モジュール パスを検出できませんでした。
AVARTISSEMENT : 中止しています..

4

1 に答える 1

0

問題は、サーバー 2014 管理スタジオのインストールが新しいパスを追加するという事実から来ていました$env:PSModulePath

C:\Users\BLANCJP\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\ 

ただし、最初のコードでは、PoSh サーバー モジュールが最後にインストールされたと想定しています。

...
  # Test Module Paths
  Foreach ($ModulePath in $ModulePaths)
  {
    $ModulePath = "$ModulePath\PoSHServer"
    $ModulePath = $ModulePath.Replace("\\","\")
    $PoSHModulePathTest = Test-Path $ModulePath
    if ($PoSHModulePathTest)
    {
      $PoSHModulePath = $ModulePath
    }
  }
}

if (!$PoSHModulePathTest)
{
  Write-Warning "Could not detect PoSH Server Module Path."
...

ブレーク命令を追加して、PoSh を再び機能させるだけです

...
  # Test Module Paths
  Foreach ($ModulePath in $ModulePaths)
  {
    $ModulePath = "$ModulePath\PoSHServer"
    $ModulePath = $ModulePath.Replace("\\","\")
    $PoSHModulePathTest = Test-Path $ModulePath
    if ($PoSHModulePathTest)
    {
      $PoSHModulePath = $ModulePath
      break
    }
  }
}

if (!$PoSHModulePathTest)
{
  Write-Warning "Could not detect PoSH Server Module Path."
...
于 2015-09-25T10:08:25.047 に答える