有人嘗試使用PowerShell配置SQL Server構面...我試着用下面的代碼..我能夠找出構面的屬性,但沒有得到如何設置這些值的想法屬性。Powershell配置SQL Server構面
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Dmf') | Out-Null
[System.Reflection.Assembly]::LoadWithPartialNam('Microsoft.SQLServer.Management.Sdk.Sfc') | Out-Null
$conn = New-Object Microsoft.SQlServer.Management.Sdk.Sfc.SqlStoreConnection("server='Ramu-pc';Trusted_Connection=true")
$PolicyStore = New-Object Microsoft.SqlServer.Management.DMF.PolicyStore($conn)
$facets = [Microsoft.SqlServer.Management.Dmf.PolicyStore]::Facets | Where {$_.Name -eq 'ISurfaceAreaFacet'}
$facets | Format-Table –Auto
當我執行下面的命令,我看到不同的方法,但我沒有得到如何使用這些方法的幫助。 $ Facets |克
我需要在上面刻面配置以下值:
- AdHocRemoteQueriesEnabled =真
- 的xp_cmdshell =真