Created
December 14, 2018 21:41
-
-
Save adamfortuno/ab7fab10d8de8856af1932d587fcd8dc to your computer and use it in GitHub Desktop.
SMO Library Load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Connect to an instance | |
[void][Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | |
$instance = New-Object 'Microsoft.SqlServer.Management.Smo.Server' -ArgumentList '<instanceName>' | |
## Connect to an innstance's WMI | |
[void][Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | |
[void][Reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | |
$instance_wmi = New-Object 'Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer' -ArgumentList '<instanceName>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment