on ‎2022 Jul 13 11:24 AM
Hi all,
hope you can help me with this one as I am totally new to powershell...
I am trying to use a shell execute path with a "start script" A to call another powershell script B.
So, here is the command in IDM:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe A.ps1 -ADuser $FUNCTION.getADcredentials(LDAP_LOGIN)$$ -ADpw $FUNCTION.getADcredentials(LDAP_PASSWORD)$$ -Accountname $FUNCTION.getUserID(%MSKEY%)$$ -Accountpw $FUNCTION.getUserPW(%MSKEY%)$$
Within script A I create a credential object (for the user context script B is executed with):
$credentials = New-Object System.Management.Automation.PSCredential $ADuser,(ConvertTo-SecureString $ADpw -AsPlainText -Force)
The argument/parameter for script B is set:
$psscript = "\\host\idm$\B.ps1 -Username $Accountname -Passwort $Accountpw"
Then, I use a start-process command to execute script B:
$ps = Start-Process powershell -Credential $credentials -argument "$psscript" -PassThru
It does not work... BUT When I run script A with all the parameters in PowerShell application it is executed without issues, also I receive the transciption from script B. What is wrong here?
Regards, Richard
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Finally ^^
First, noticed that powershell does not like some special characters like & or ( ) when calling a script. Second, no need for the credential object if the separate dispatcher is running under the right useraccount *facepalm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.