Phil Parkin - Friday, October 6, 2017 6:49 AM
Yes very much right it is not the right thing..thanks for sharing me the link
Let me try to get this tested but still i am not progressing and feel the SQL authentication part is still not working. When i execute my script i am not getting an error but the o/p generating the expected fragmentation report from the database is not coming.
# Connect to the specified instance
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
$srv = new-object ('Microsoft.SqlServer.Management.Smo.Server') "LOCALHOST"
#This sets the connection to mixed-mode authentication
$srv.ConnectionContext.LoginSecure=$false;
#This sets the login name
$srv.ConnectionContext.set_Login("abc_XXXX");
#This sets the password
$srv.ConnectionContext.set_Password("defghijkl")
Regards
Eben