Powershell EnableFILESTREAM不起作用
我运行此脚本,但它不起作用。 运行$wmi.EnableFILESTREAM(1,“SQLSERVER2008”)之前和之后的$wmi.AccessLevel仍然为0Powershell 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
$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()