Run Power Shell Script via CPM.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

Run Power Shell Script via CPM.

L4 Transporter

I have service account that I will be using for Veeam Backups.  The service account has to be in the domain admin group.

 

I would like to set the password to be CPM controlled but also have the CPM change the password within the Veeam environment.

 

The password can be changed via PS script as long as the VeeamPSSnapin is loaded into the PS shell.

 

https://helpcenter.veeam.com/docs/backup/powershell/add-vbrcredentials.html?ver=95

 

Question: anyone do anything like this before.  Can the CPM be configured to run a PS1 script at the same time that it changes the password in Active Directory?

 

31 REPLIES 31

L0 Member

Yes you can, I've done this before. You can spawn the PS script in the following way:

(spawn)"powershell.exe" "-version" "2" "-file" ...

Hi, you don't even need to step down to Powershell version 2 anymore if you use the new plug-in executable "CyberArk.TPC.exe".

L2 Linker

@davezuver - did you ever get this working?

L1 Bithead

@wri Can you please help explain how to use CyberArk TPC to run a powershell Script. We have to make some REST calls to make password changes. We are running into issues with that due to Powershell version 2

Hi Simar, this is how i did it:

 

[states]

#Start spawn sequence

StartScript=(spawn)C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe & '.\bin\ScriptREST.ps1' -action '<action>' -address '<address>' -username '<username>' -password '$curr_pass' -newpass '$new_pass'

 

[transitions]

# Various error handles

StartScript,        UnableToConnect,      FAILUnableToConnect

 

The script handles every action so i use a variable to pass it to the script.

Make sure that in the powershell script you enable TLS1.2 or otherwise you can run into connecting issues too.

L1 Bithead

Hi Wri,

 

I am able to run powershell version 2 with pmterminal.exe but the same is not working with Cyberark.TPC.exe. Is there any additional configurations that needs to be done to make it compatible with Cyberark.TPC.exe

L3 Networker

When I use the similar configuration(PMTerminal) to spawn powershell script it throws the following error

"Version v4.0.30319 of the .NET Framework is not installed and it is required to run version 3 of Windows PowerShell.\n"

 

Though checking $PSVersionTable returns with latest .NET installed on the server.

 

Any insights as to how to resolve this?

Hi, you should check the spawn line for correct quoting as quotes are very important to make it spawn correctly

Only version 2 of powershell will work with PMTerminal, see earlier reaction above to see the syntax

We did update the spawn command to pick version 2 and it gives with the lowest version is not available.

CallWrapperRotate=(spawn)C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -version 2 bin\\test.ps1

 

Version v2.0.50727 of the .NET Framework is not installed and it is required to run version 2 of Windows PowerShell.

 

Changing the version number in Spawn command comes back with the error of an supported .NET version is not installed.

 

Opening a powershell and running $PSVersionTable brings up with 4.0.30319.42000 installed.

 

L2 Linker

Hello,

is it possible to know how to pass password in powershell.exe argument using CyberArk TPC module?

Hello, i tried by this way the script powershell runs fine but i'm unable to pass the the newpassword value in the script argument. do you have an idea?

L2 Linker

Hello, i tried by this way the script powershell runs fine susing TPC plugin, but i'm unable to pass the the newpassword value in the script argument. have an idea?

L3 Networker

Maybe you're not in the right phase? Maybe you are in the Logon phase and not the Change phase. Is the variable filled at that time?

  • 4817 Views
  • 31 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!