This message was deleted.
# citrix-wem
s
This message was deleted.
j
External task powershell script?
m
That’s what I’m working on now. I’m not much of a scripting guy but I think I have the right syntax to ask for both username and password (Get-Credential) but for some reason it doesn’t work. I think because when using Get-Credential it’s asking for a username only and a password, and I need to capture and pass domain\username and not just username.
j
maybe something like this?
Copy code
# Prompt for credentials
$credentials = Get-Credential
$driveLetter = “S”

$domain = $credentials.GetNetworkCredential().Domain
$username = $credentials.GetNetworkCredential().UserName
$password = $credentials.GetNetworkCredential().Password

$newCredentials = New-Object System.Management.Automation.PSCredential -ArgumentList ("$domain\$username", (ConvertTo-SecureString -String $password -AsPlainText -Force))

New-PSDrive -Name $driveLetter -PSProvider FileSystem -Root "\\Server\Share" -Credential $newCredentials
👍 3
n
^This is the way.
m
Thanks @James Kindon I’ll give that a try! Much appreciate the help!
Hey @James Kindon this has the same problem as my other script. It runs successfully but no drive appears.
I tried Scope -Global and -Persist with no luck
Seems you have to use -global scope and -persist together
👍 1
Seems to work now! Thanks again
👍 2