2015-09-25 82 views
0

我目前使用PoSH服务器在我的服务器上托管一个小型统计应用(仅用于amdin使用)。安装SQL Server 2014后PoSh停止工作

安装的SQL Server 2014 Management Studio中的后,辣妹服务器拒绝启动与错误:

AVERTISSEMENT : Could not detect PoSH Server Module Path.
AVERTISSEMENT : Aborting..

回答

0

这个问题是从这一事实出现以后,服务器2014 Management Studio中的安装添加新路径到$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." 
... 

我刚才添加的暂停指令有我的辣妹再次合作

... 
    # 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." 
... 
相关问题