Powershell and SQL Server – 3- Script SQL Server Logins with SMO

The Script is to quickly script out Login from Single or Multiple instance


$SQLserverDB=Get-Content "C:\PowershellScript\ServerList.txt"
    foreach($SqlServer in $SQLserverDB)
        $server = New-Object Microsoft.SqlServer.Management.Smo.Server($SqlServer)
        Write-Host "---Login Script of :"$server"---" -ForegroundColor Yellow

        foreach($login in $Logins)



Leave a Reply

Your email address will not be published. Required fields are marked *