Advertisement
Guest User

Untitled

a guest
Feb 14th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $Email = Read-Host -Prompt 'Enter your E-mail Address'
  2.  
  3. $User = Get-ADUser -Filter {EmailAddress -eq $Email} -Properties sAMAccountName | select sAMAccountName | select -ExpandProperty sAMAccountName
  4.  
  5. $password = read-host "Enter your E-mail Password:" -assecurestring
  6.  
  7. $cred = New-Object System.Management.Automation.PSCredential($User,$password)
  8.  
  9.  
  10. New-PSDrive -Name P -PSProvider FileSystem -Root \\Fileserver -Credential $cred -Persist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement