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

Add a way to specify a value for $PSNativeCommandArgumentPassing #210

Open
sdwheeler opened this issue May 8, 2024 · 0 comments
Open

Add a way to specify a value for $PSNativeCommandArgumentPassing #210

sdwheeler opened this issue May 8, 2024 · 0 comments
Labels
Issue-Enhancement New feature or request

Comments

@sdwheeler
Copy link
Contributor

sdwheeler commented May 8, 2024

Summary of the new feature / enhancement

Take for example the Windows native command vaultcmd.exe. That command has parameters that take values that require quotes. When $PSNativeCommandArgumentPassing = 'Windows' (which is the default) the command fails. When set to Legacy it works.

Example

vaultcmd /listcreds:"windows credentials"

Output

Credentials in vault: windows credentials

Credential schema: Windows Domain Password Credential
Resource: Domain:target=mydomain
Identity: COMPUTER\admin
Hidden: No
Roaming: No
Property (schema element id,value): (100,3)
Property (schema element id,value): (101,SspiPfc)

Credential schema: Windows Domain Password Credential
Resource: Domain:target=myotherpc
Identity: liveaccount@live.com
Hidden: No
Roaming: No
Property (schema element id,value): (100,3)
Property (schema element id,value): (101,SspiPfc)
$cmd = 'vaultcmd'
$arg = '/listcreds:"windows credentials"'
& $cmd $arg

Output

Invalid vault: Element not found.

When you switch to Legacy mode, the command invocation works.

$PSNativeCommandArgumentPassing = 'Legacy'
& $cmd $arg

Output

Credentials in vault: windows credentials

Credential schema: Windows Domain Password Credential
Resource: Domain:target=mydomain
Identity: COMPUTER\admin
Hidden: No
Roaming: No
Property (schema element id,value): (100,3)
Property (schema element id,value): (101,SspiPfc)

Credential schema: Windows Domain Password Credential
Resource: Domain:target=myotherpc
Identity: liveaccount@live.com
Hidden: No
Roaming: No
Property (schema element id,value): (100,3)
Property (schema element id,value): (101,SspiPfc)

Proposed technical implementation details (optional)

Add a property that allows you to set the value of $PSNativeCommandArgumentPassing.

Add the assignment to the begin block of the cmdlet function generated.

@sdwheeler sdwheeler added the Issue-Enhancement New feature or request label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant