Advertisement
Guest User

Untitled

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