Hello Prabhjoy
The issue you're facing is due to the way PowerShell is trying to execute the dsregcmd
command. The problem is that the script is trying to run dsregcmd
as a PowerShell command, which is not correct. dsregcmd
is a standalone executable, not a PowerShell command.
To fix this, you can modify your PowerShell script to simply execute the dsregcmd
command as a separate process, like this:
& "C:\Windows\System32\dsregcmd.exe" /status
This will execute the dsregcmd
command and capture its output.
Alternatively, you can modify your package's command line to run the PowerShell script without trying to execute dsregcmd
as a PowerShell command. You can do this by changing the command line to:
"%Windir%\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy ByPass -file "C:\Path\To\Dsregcmd.ps1"
This will run the Dsregcmd.ps1
script as a separate PowerShell process, which should execute the dsregcmd
command correctly.
As for permissions-related issues, make sure that the account running the script has the necessary permissions to execute the dsregcmd
command. The dsregcmd
command requires elevated privileges to run, so you may need to add the necessary permissions or run the script as an administrator.
I hope this helps! Let me know if you have any further questions.