﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Chad Miller / Article Discussions / Article Discussions by Author  / use SQL authentication on the provided powershell scripts / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 06:06:58 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: use SQL authentication on the provided powershell scripts</title><link>http://www.sqlservercentral.com/Forums/Topic930521-106-1.aspx</link><description>I guess singling out cmille to reply isn't working in my favor...:hehe: Can anyone help please :-D</description><pubDate>Tue, 01 Jun 2010 22:22:42 GMT</pubDate><dc:creator>mojo.jojo</dc:creator></item><item><title>RE: use SQL authentication on the provided powershell scripts</title><link>http://www.sqlservercentral.com/Forums/Topic930521-106-1.aspx</link><description>Hi again Cmille19,I am using the ff ps to successfully connect to an instance using sql authentication.  But can't seem to integrate this with the PS scripts you provided.  Hope you can help me out.  THanks again. param(        [string]$serverName = "instance_name",	[switch]$verbose,	[switch]$debug)function main(){	if ($verbose) {$VerbosePreference = "Continue"}	if ($debug) {$DebugPreference = "Continue"}        Connect-MSSQL-IPSQLAuth $serverName}function Connect-MSSQL-IPSQLAuth($serverName){	trap [Exception] 	{		write-error $("TRAPPED: " + $_.Exception.Message);		continue;	}		[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")	[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlEnum")	[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum")	[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")		$smoServer = New-Object -typename Microsoft.SqlServer.Management.Smo.Server `                -argumentlist "$serverName"		$smoServer.ConnectionContext.set_LoginSecure($FALSE)		$LoginCredentials = Get-Credential		$Login = $LoginCredentials.UserName -replace("\\","")		$smoServer.ConnectionContext.set_EncryptConnection($FALSE)	$smoServer.ConnectionContext.set_Login($Login)	$smoServer.ConnectionContext.set_SecurePassword($LoginCredentials.Password)		# The ff tests a successful db connect	cls	Write-Host Your connection string contains these values:	Write-Host	Write-Host $smoServer.ConnectionContext.ConnectionString.Split(";")	Write-Host		# List info about databases on the instance.        Write-Host "Databases on $serverName "        Write-Host        foreach ($Database in $smoServer.Databases)         {                write-host "Database Name : " $Database.Name                write-host "Owner         : "   $Database.Owner                write-host        }}main</description><pubDate>Mon, 31 May 2010 23:37:18 GMT</pubDate><dc:creator>mojo.jojo</dc:creator></item><item><title>use SQL authentication on the provided powershell scripts</title><link>http://www.sqlservercentral.com/Forums/Topic930521-106-1.aspx</link><description>Hi Cmille 19.  I have tried both powershell scripts without any problems on SQL DBs who are members of our Windows domain.  However, I need to connect to a MSSQL DB that is not a member of our domain.  Can you give us PS1 using SQL authentication?  THanks in advance</description><pubDate>Mon, 31 May 2010 22:35:01 GMT</pubDate><dc:creator>mojo.jojo</dc:creator></item></channel></rss>