Install SqlServer module:
Install-Module -Name sqlserver
Typical warning:
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
See installed module:
Get-Module -Name SqlServer -ListAvailable
Import SqlServer module in PowerShell session:
Import-Module -Name SqlServer
Create SMO Server object:
$smoServer = New-Object Microsoft.SqlServer.Management.Smo.Server '(local)\SSDB2019'
See SMO Server object information:
$smoServer.Information
No comments:
Post a Comment