Advertisement
Guest User

Untitled

a guest
May 18th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. Exception calling "Create" with "1" argument(s): "Create failed for Login 'bilal'. "
  2.  
  3. $server="WIN-SH7H3HP7KMISQL2014"
  4. $User="bilal"
  5. $password="test"
  6.  
  7. if(!($svr.Logins.Contains($User)))
  8. {
  9.  
  10. $login = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Login -ArgumentList $server, $User
  11. $login.LoginType = [Microsoft.SqlServer.Management.Smo.LoginType]::SqlLogin
  12. $login.PasswordExpirationEnabled = $false
  13. $login.Create($password)
  14. Write-Host("Login $loginName created successfully.")
  15.  
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement