IsraelTorres

PSTemplate.ps1

Mar 15th, 2012
229
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Israel Torres
  2. # 2012-03-14
  3. # PowerShell template
  4. Import-Module ActiveDirectory
  5. #
  6. # args: username, password
  7. if($args.Length -eq 2){
  8. $username = $args[0]
  9. $password = $args[1]
  10.     if (!(Get-ADUser -filter {SamAccountName -eq $username})) {
  11.         Write-Host "Doing something with User:$username"
  12.                 #cmdlet $username
  13.     }else{
  14.             Write-Host "User: $username already exists; do something else."
  15.     }
  16. }else{
  17.     Write-Host "Usage: .\PSTemplate.ps1 username password"
  18. }
  19. #EOF
RAW Paste Data