WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: domvalle@comcast.net on November 05, 2019, 12:22:34 PM

Title: wntAddDrive & save credentials
Post by: domvalle@comcast.net on November 05, 2019, 12:22:34 PM
When using wntAddDrive and persist: @TRUE, the password is not remembered after a logoff.
Is there any way to force this?
We are using Win 10 Pro and Winbatch 2019B.
thanks!
Title: Re: wntAddDrive & save credentials
Post by: td on November 05, 2019, 01:19:16 PM
Assuming you are referring to the credentials used to access the share you have mapped to a drive, you need to save the credentials in Windows 10's Credential Manager.  You can do this manually via an applet UI.  See the following for an easy way to access the applet on Windows 10.

https://support.microsoft.com/en-ca/help/4026814/windows-accessing-credential-manager

I know you can access the credential manager's cache of user names and passwords using dotNet or WMI.  However, I don't remember if you can add credentials.  I look into it and report back if I find something.
Title: Re: wntAddDrive & save credentials
Post by: td on November 05, 2019, 02:20:27 PM
There is always the cmdkey.exe utility that allows you to add or remove credentials from the Windows "vault".  Type "cmdkey.exe /?" from a command prompt to see usage.

There is a Powershell module for the credential manager around someplace but I am not sure that it is still supported.  I image it was just a cover for the Win32 Credential Manager API.  -  The API might make a good WIL extender.

Still think there might be a scripting solution but can't seem to come up with one at the moment.  Maybe some else has an idea.

Title: Re: wntAddDrive & save credentials
Post by: domvalle@comcast.net on November 06, 2019, 10:27:23 AM
Actually  cmdkey.exe worked great!
used with the doscapture extender, nice!
thanks!
Title: Re: wntAddDrive & save credentials
Post by: td on November 06, 2019, 01:19:43 PM
Some users prefer not to spin up a child process by running a command shell application but if that is not an issue for you,  you have your solution.
Title: Re: wntAddDrive & save credentials
Post by: td on November 06, 2019, 02:26:07 PM
There are several ways to capture a command shell window's output without using an extender documented in the Tech Database.  Here is a link to one of them

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/DOS+Capture~DOS~Window~output.txt (https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/DOS+Capture~DOS~Window~output.txt)