Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell EnableFILESTREAM不起作用_Powershell_Powershell 2.0 - Fatal编程技术网

Powershell EnableFILESTREAM不起作用

Powershell EnableFILESTREAM不起作用,powershell,powershell-2.0,Powershell,Powershell 2.0,我运行此脚本,但它不起作用。 运行$wmi.EnableFILESTREAM(1,“SQLSERVER2008”)之前和之后的$wmi.AccessLevel仍然为0 $strComputer = "." $strInstanceName = "SQLSERVER2008" $wmi=Get-WmiObject -computerName $strComputer -namespace root\Microsoft\SqlServer\ComputerManagement10 -class FI

我运行此脚本,但它不起作用。 运行$wmi.EnableFILESTREAM(1,“SQLSERVER2008”)之前和之后的$wmi.AccessLevel仍然为0

$strComputer = "."
$strInstanceName = "SQLSERVER2008"
$wmi=Get-WmiObject -computerName $strComputer -namespace root\Microsoft\SqlServer\ComputerManagement10 -class FILESTREAMSettings -filter "InstanceName='SQLSERVER2008'"
Write-Output $wmi.AccessLevel
$wmi.EnableFILESTREAM(2, "SQLSERVER2008") 
$wmi=Get-WmiObject -computerName $strComputer -namespace root\Microsoft\SqlServer\ComputerManagement10 -class FILESTREAMSettings -filter "InstanceName='SQLSERVER2008'"
Write-Output $wmi.AccessLevel
来自PowerShell。重要的部分是“重新配置”

在这里阅读myabe可以帮助你
EXEC sp_configure filestream_access_level, 2
RECONFIGURE
$ServerInstance = "SQLSERVER2008"
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection
$sqlConnection.ConnectionString = "Server=$ServerInstance;Database=master;Trusted_Connection=True;"

$Command = $sqlConnection.CreateCommand()
$Command.CommandText = "EXEC sp_configure filestream_access_level, 2; RECONFIGURE"

$sqlConnection.Open()
$Command.ExecuteNonQuery() | Out-Null
$sqlConnection.Close()