NCPA Powershell Plugin trouble passing arguments
Posted: Wed May 01, 2024 5:01 pm
I am having trouble passing parameters using a custom powershell plugin from a Windows machine running the NCPA 3.0.0.client.
To help with testing, I wrote the following PS script:
param (
[string]$F='John',
[string]$L='Doe',
[string]$M='E'
)
write-host "Success! $($F) $($M) modified $($L)."
Exit 0
Then, I try passing parameters, initially with Powershell named parameters like -F Joe -L Donuts, but that didn't work at all. Eventually I settled on using positional parameters, but have had issues getting that to work as well.
To test, I am modifying the nrdp.cfg on the Windows machine, restarting the service and then going to http://localhost:5693/gui/checks.
I have tried lots of combinations with varying results. For example:
%HOSTNAME%|TestArgs = plugins/testargs.ps1 --args Joe Donuts S"
returns Joe E Doe
Here are some of my notes, sorry they are a little disorganized. Keep in mind F used to be First, M - Middle, L - Last
-a did not work
--args 'G K B' not working at all
--args 'G,K,B' treats as first argument only
--args '-First G' not working
--args '--First G' not working
--args "-First G" not working
--args "-First 'G'"
--args -First G - specify a system string
--args -First "G" - Same
--args -First 'G' - Same
--args 'G','k' recognized first two params, but included quotes
--args Gar,k combined into 1 parameter.
--args "Gar ak","k" not working at all - Same with single quotes - doesn't seem to like spaces.
Gar,F,Eild - combined
"Gar","F","Eild" - correclty set first to "Gar" but combimed "F","Eild" together for last
"Gar,F,Eild" - combined into first
To help with testing, I wrote the following PS script:
param (
[string]$F='John',
[string]$L='Doe',
[string]$M='E'
)
write-host "Success! $($F) $($M) modified $($L)."
Exit 0
Then, I try passing parameters, initially with Powershell named parameters like -F Joe -L Donuts, but that didn't work at all. Eventually I settled on using positional parameters, but have had issues getting that to work as well.
To test, I am modifying the nrdp.cfg on the Windows machine, restarting the service and then going to http://localhost:5693/gui/checks.
I have tried lots of combinations with varying results. For example:
%HOSTNAME%|TestArgs = plugins/testargs.ps1 --args Joe Donuts S"
returns Joe E Doe
Here are some of my notes, sorry they are a little disorganized. Keep in mind F used to be First, M - Middle, L - Last
-a did not work
--args 'G K B' not working at all
--args 'G,K,B' treats as first argument only
--args '-First G' not working
--args '--First G' not working
--args "-First G" not working
--args "-First 'G'"
--args -First G - specify a system string
--args -First "G" - Same
--args -First 'G' - Same
--args 'G','k' recognized first two params, but included quotes
--args Gar,k combined into 1 parameter.
--args "Gar ak","k" not working at all - Same with single quotes - doesn't seem to like spaces.
Gar,F,Eild - combined
"Gar","F","Eild" - correclty set first to "Gar" but combimed "F","Eild" together for last
"Gar,F,Eild" - combined into first