Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/PF gives "Invalid parameter" error #21

Open
JoanEliot opened this issue Nov 12, 2020 · 7 comments
Open

/PF gives "Invalid parameter" error #21

JoanEliot opened this issue Nov 12, 2020 · 7 comments

Comments

@JoanEliot
Copy link

JoanEliot commented Nov 12, 2020

Originally I thought there was a problem with /PF because I got an error when using the parameter in the wrong place.

This is incorrect:
psubst /PF K: C:\z\K
(but psubst /P K: C:\z\K did not throw an error)


Now I have an error when using /PF in the right place:
C:\util>psubst K: C:\z\K /PF
psubst: Unable to add persistently SUBSTed drive

However, pubst /P reports the drive as present, despite the error. Does that mean I have a SUBSTed drive with the features of a /P persistence, but not those expected with /PF?

C:\util>psubst /P
K:\: => C:\z\K
@ildar-shaimordanov
Copy link
Owner

That's correct because the order of the arguments and options is mandatory. Run the tool with /? option and to learn more about usage. The correct usage is as follows:

PSUBST [drive1: [drive2:]path] [/P | /PF]

@JoanEliot
Copy link
Author

JoanEliot commented Nov 12, 2020

Sorry! I missed your reply before I edited my original post. I figured out I had the argument in the wrong place, and then ran into a new issue as above. But as for the order of arguments point, I get no error message with pubst /P so maybe an update to recognize that also as an out-of-order parameter?

@ildar-shaimordanov
Copy link
Owner

The command psubst /P K: C:\z\K doesn't throw any issues because it's executed as this one psubst /P (ignoring everything after /p).

Regarding the second issue Unable to add persistently SUBSTed drive. I reviewed the code and didn't find any reasons to throw it with the /pf option. This could happen with the /p option only (and without elevated privileges).

Can you remove the entry with the command psubst K: /d /pf, then repeat the creation command psubst K: C:\z\K /PF? Let me know more details.

@JoanEliot
Copy link
Author

JoanEliot commented Nov 13, 2020

Results (non-elevated or elevated, same):

>psubst K: /d /pf
psubst: Drive not SUBSTed persistently
>k:
K:\>
>psubst K: C:\z\K /PF
psubst: Unable to add persistently SUBSTed drive

But regardless, the 'K drive' is working and giving me no trouble—I don't seem to need whatever /PF offers.

@ildar-shaimordanov
Copy link
Owner

ildar-shaimordanov commented Nov 14, 2020

I need to understand or become closer in understanding what's wrong in your situation. Would you be perform the following steps:

  1. Run these commands first time before starting to modify old entries:
    reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices" tempfile
    type tempfile
    
  2. open RegEdit application and proceed the path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices; find the K: value and delete it
  3. Run psubst /p
  4. Run psubst K: C:\z\K /PF
  5. Run psubst /p again

Share results here.

@JoanEliot
Copy link
Author

Sorry for not replying earlier. Still pretty busy so can't promise prompt feedback but here you go—

Results (tempfile listing -- note that there is no entry for K )

"AUX"="\\DosDevices\\COM1"
"CON"="\\Device\\ConDrv\\Console"
"CONIN$"="\\Device\\ConDrv\\CurrentIn"
"CONOUT$"="\\Device\\ConDrv\\CurrentOut"
"MAILSLOT"="\\Device\\MailSlot"
"NUL"="\\Device\\Null"
"PIPE"="\\Device\\NamedPipe"
"PRN"="\\DosDevices\\LPT1"
"Silos"="\\Silos"
"UNC"="\\Device\\Mup"

>psubst K: C:\z\K /PF
psubst: Unable to add persistently SUBSTed drive

@ildar-shaimordanov
Copy link
Owner

ildar-shaimordanov commented Dec 4, 2020

@JoanEliot, I guess, the user you work with doesn't have writing permissions in the particular subkey. Let's try one more attempt.

  1. Download the file sudo.bat from this link: https://raw.githubusercontent.com/ildar-shaimordanov/cmd.scripts/master/unix-like/sudo.bat. Save it next to psubst.bat
  2. Run it. It will open a new console window (titled as "Administrator")
  3. In this new window run the command psubst K: C:\z\K /p
  4. Check the list of SUBSTed drives with psubst /p
  5. Show the Windows version running the command ver

Capture the results of all commands you execute in this attempt and share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants