安装 SQL Server 2014 后 PoSh 停止工作
PoSh stop working after the installation of SQL Server 2014
我目前正在使用 PoSH 服务器在我的服务器上托管一个小型统计应用程序(仅供 amdin 使用)。
安装 SQL Server 2014 Management Studio 后,PoSh 服务器拒绝启动并出现错误:
AVERTISSEMENT : Could not detect PoSH Server Module Path.
AVERTISSEMENT : Aborting..
问题出在安装 server 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 Server0\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."
...
我目前正在使用 PoSH 服务器在我的服务器上托管一个小型统计应用程序(仅供 amdin 使用)。
安装 SQL Server 2014 Management Studio 后,PoSh 服务器拒绝启动并出现错误:
AVERTISSEMENT : Could not detect PoSH Server Module Path.
AVERTISSEMENT : Aborting..
问题出在安装 server 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 Server0\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."
...