New
#1
Please help with multi-user webdav login credentials prompt
Hi all, I'm a linux guy and a windows beginner sorry.
At work we have a need to setup a Win10 local user to service a specific client. On occasion we will have different staff login to this same desktop to service that client. The catch is that I want a mapped webdav drive to be connected at logon using that staff members credentials. I created a login powershell script to ask credentials at login then disconnect the drive at logout. It works fine for the admin user, but not a standard user.
I've reduced the script delay to 0 seconds and can see in logs it does run but the user is never asks for credentials so I can't see why it is failing. If I execute the script manually when logged in as that user it works fine. So why isn't it working at login?
Here is the script for reference:
$credential = $host.ui.PromptForCredential("NextCloud credentials", "Please enter your user name and password for my-webdav.com.", "","")
$username = $credential.UserName
[String]$WebDAVShare = "\\my-webdav.com@SSL\remote.php\dav\files\$username\"
New-PSDrive -Name "O" -Root $WebDAVShare -PSProvider FileSystem -Credential $credential -Scope Global
net use O: $WebDAVShare
* Secondly is there a way I can remove the option to "Remember my credentials" from mapped drives? This window can be shown if the unmount fails on next login etc.