PowerShell module for the CyberArk PACLI command line utility
PoShPACLI runs CyberArk PACLI commands as PowerShell functions. Results come back as objects, so you can pipe them into other commands.
Tip
Automating CyberArk? Look at psPAS first: it uses the REST API, which covers most tasks. PoShPACLI is for jobs that still need PACLI.
- Features
- Requirements
- Installation
- Quick Start
- Usage
- Command Reference
- Changelog · License · Contributing
- One function per PACLI command: 116 functions with full help (
Get-Help <Function> -Full). - Session values remembered:
sessionID,vaultanduserare kept by the module and added to every command for you. - Object output: list commands return typed objects with formatting, ready for the pipeline.
- Tab completion: safe, user, group, location and network area names complete from the connected vault.
- Secret handling: passwords are
SecureStringvalues. They are decoded only when the PACLI process starts, masked in-WhatIfand-Debugoutput, and kept out of PowerShell logging. -WhatIfsupport: commands that create, change or remove vault data show the PACLI command line without running it.
| Component | Version |
|---|---|
| PowerShell | Windows PowerShell 5.1 or PowerShell 7.x on Windows |
| CyberArk PACLI | 7.2 or later (current releases supported) |
| CyberArk Vault user | Vault and Safe permissions for the operations you run |
PACLI is part of the CyberArk PACLI package, available from the CyberArk Marketplace. Install it on the same computer as the module.
Install-Module -Name PoShPACLI -Scope CurrentUser- Download a release or the master branch.
- Copy the
PoShPACLIfolder to a directory listed in$env:PSModulePath.
Import-Module PoShPACLI
Get-Command -Module PoShPACLI# One-time: point the module at PACLI.exe (saved to ~\PV_Configuration.xml)
Set-PVConfiguration -ClientPath D:\PACLI\Pacli.exe
# Create a logon file once, instead of passing a password on the command line
New-PVLogonFile -logonFile "$env:USERPROFILE\vault.cred" -username administrator -password (Read-Host -AsSecureString)
# Start a session, define the vault and log on
Start-PVPacli -sessionID 1
New-PVVaultDefinition -vault Vault -address 10.0.0.10
Connect-PVVault -user administrator -logonFile "$env:USERPROFILE\vault.cred"
# Work with the vault
Get-PVSafeList | Select-Object Safename, Location
# Log off and stop PACLI
Disconnect-PVVault
Stop-PVPacliAfter Start-PVPacli, New-PVVaultDefinition and Connect-PVVault, later commands use the same session, vault and user. Check the current values with Get-PVConfiguration.
PoShPACLI follows the same steps as PACLI: start a session, define a vault, log on, open safes, run commands, then log off. Command Reference shows which function runs each PACLI command.
Open-PVSafe -safe Linux-Accounts
New-PVFolder -safe Linux-Accounts -folder Root\Servers
Add-PVPasswordObject -safe Linux-Accounts -folder Root\Servers -file root-web01 -password (Read-Host -AsSecureString)
# Returns the password as a SecureString
$Secret = Get-PVPasswordObject -safe Linux-Accounts -folder Root\Servers -file root-web01 -AsSecureString
Close-PVSafe -safe Linux-Accounts-AsSecureString keeps the password out of plain-text output and pipeline logs.
Functions accept pipeline input by property name, so output from one command feeds the next:
# Details of every safe in a location
Get-PVSafeList -location \Linux | Get-PVSafe | Select-Object Safename, Size, Location
# Open each safe in a location and list its files
Get-PVSafeList -location \Linux | Open-PVSafe | Get-PVFileList -folder RootWhen connected to a vault, Tab completes names from the vault:
| Parameter | Completes |
|---|---|
safe, safeName |
Safe names |
destUser, owner, member, trusterName |
User and group names |
group |
Group names |
location |
Location paths |
networkArea |
Network area names |
Open-PVSafe -safe Lin<Tab>
# Open-PVSafe -safe Linux-Accounts- Results are cached for 5 minutes per vault, user and session.
- Locations complete with or without the leading
\. - Parameters that take a new name, such as
New-PVSafe -safe, are not completed.
Commands that create, change or remove vault data support -WhatIf, which shows the PACLI command line without running it. Secret values are masked.
Remove-PVSafeOwner -safe Linux-Accounts -owner jsmith -WhatIf- Use
Connect-PVVault -logonFileinstead of-password. PACLI receives passwords as plain text on its process command line, so other processes on the machine can read them.Connect-PVVaultwarns when-passwordis used. PV_Configuration.xmlin your profile stores the PACLI path, session ID, vault name and user name. It stores no credentials.
Each function runs one PACLI command. The tables below are grouped by area.
Full help: Get-Help <Function> -Full.
Module configuration
| PACLI command | Function |
|---|---|
| - | Set-PVConfiguration |
| - | Get-PVConfiguration |
| INIT | Start-PVPacli |
| TERM | Stop-PVPacli |
Session management
| PACLI command | Function |
|---|---|
| DEFINE | New-PVVaultDefinition |
| DEFINEFROMFILE | Import-PVVaultDefinition |
| CREATELOGONFILE | New-PVLogonFile |
| LOGON | Connect-PVVault |
| LOGOFF | Disconnect-PVVault |
| CTLGETFILENAME | Get-PVCTL |
| CTLADDCERT | Add-PVCTLCertificate |
| CTLLIST | Get-PVCTLCertificate |
| CTLREMOVECERT | Remove-PVCTLCertificate |
Safes
| PACLI command | Function |
|---|---|
| SAFESLIST | Get-PVSafeList |
| SAFEDETAILS | Get-PVSafe |
| ADDSAFE | New-PVSafe |
| UPDATESAFE | Set-PVSafe |
| RENAMESAFE | Rename-PVSafe |
| DELETESAFE | Remove-PVSafe |
| OPENSAFE | Open-PVSafe |
| CLOSESAFE | Close-PVSafe |
| RESETSAFE | Reset-PVSafe |
| CLEARSAFEHISTORY | Clear-PVSafeHistory |
| INSPECTSAFE | Get-PVSafeActivity |
| SAFESLOG | Get-PVSafeLog |
| ADDNOTE | Set-PVSafeNote |
| SAFEEVENTSLIST | Get-PVSafeEvent |
| ADDEVENT | Write-PVSafeEvent |
| OWNERSLIST | Get-PVSafeOwner |
| ADDOWNER | Add-PVSafeOwner |
| UPDATEOWNER | Set-PVSafeOwner |
| DELETEOWNER | Remove-PVSafeOwner |
| OWNERSAFESLIST | Get-PVUserSafeList |
| LISTSAFEFILECATEGORIES | Get-PVSafeFileCategory |
| ADDSAFEFILECATEGORY | New-PVSafeFileCategory |
| UPDATESAFEFILECATEGORY | Set-PVSafeFileCategory |
| DELETESAFEFILECATEGORY | Remove-PVSafeFileCategory |
| RETRIEVEPASSWORDOBJECT | Get-PVPasswordObject |
Folders and files
| PACLI command | Function |
|---|---|
| FOLDERSLIST | Get-PVFolder |
| ADDFOLDER | New-PVFolder |
| MOVEFOLDER | Move-PVFolder |
| DELETEFOLDER | Remove-PVFolder |
| UNDELETEFOLDER | Restore-PVFolder |
| ADDPREFERREDFOLDER | Add-PVPreferredFolder |
| DELETEPREFERREDFOLDER | Remove-PVPreferredFolder |
| FILESLIST | Get-PVFileList |
| FILEVERSIONSLIST | Get-PVFileVersionList |
| FINDFILES | Find-PVFile |
| STOREFILE | Add-PVFile |
| RETRIEVEFILE | Get-PVFile |
| STOREPASSWORDOBJECT | Add-PVPasswordObject |
| MOVEFILE | Move-PVFile |
| DELETEFILE | Remove-PVFile |
| UNDELETEFILE | Restore-PVFile |
| RESETFILE | Reset-PVFile |
| LOCKFILE | Lock-PVFile |
| UNLOCKFILE | Unlock-PVFile |
| INSPECTFILE | Get-PVFileActivity |
| VALIDATEOBJECT | Set-PVObjectValidation |
| LISTFILECATEGORIES | Get-PVFileCategory |
| ADDFILECATEGORY | Add-PVFileCategory |
| UPDATEFILECATEGORY | Set-PVFileCategory |
| DELETEFILECATEGORY | Remove-PVFileCategory |
| RULESLIST | Get-PVRule |
| ADDRULE | Add-PVRule |
| DELETERULE | Remove-PVRule |
Users and groups
| PACLI command | Function |
|---|---|
| USERSLIST | Get-PVUserList |
| USERDETAILS | Get-PVUser |
| ADDUSER | New-PVUser |
| UPDATEUSER | Set-PVUser |
| RENAMEUSER | Rename-PVUser |
| DELETEUSER | Remove-PVUser |
| LOCK | Lock-PVUser |
| UNLOCK | Unlock-PVUser |
| SETPASSWORD | Set-PVUserPassword |
| INSPECTUSER | Get-PVUserActivity |
| CLEARUSERHISTORY | Clear-PVUserHistory |
| GETUSERPHOTO | Get-PVUserPhoto |
| PUTUSERPHOTO | Set-PVUserPhoto |
| MAILUSER | Send-PVMailMessage |
| ADDUPDATEEXTERNALUSERENTITY | Add-PVExternalUser |
| ADDSAFESHARE | Add-PVSafeGWAccount |
| DELETESAFESHARE | Remove-PVSafeGWAccount |
| GROUPDETAILS | Get-PVGroup |
| ADDGROUP | New-PVGroup |
| UPDATEGROUP | Set-PVGroup |
| DELETEGROUP | Remove-PVGroup |
| GROUPMEMBERS | Get-PVGroupMember |
| ADDGROUPMEMBER | Add-PVGroupMember |
| DELETEGROUPMEMBER | Remove-PVGroupMember |
| LOCATIONSLIST | Get-PVLocation |
| ADDLOCATION | New-PVLocation |
| UPDATELOCATION | Set-PVLocation |
| RENAMELOCATION | Rename-PVLocation |
| DELETELOCATION | Remove-PVLocation |
| LDAPBRANCHESLIST | Get-PVLDAPBranch |
| LDAPBRANCHADD | New-PVLDAPBranch |
| LDAPBRANCHUPDATE | Set-PVLDAPBranch |
| LDAPBRANCHDELETE | Remove-PVLDAPBranch |
Network areas
| PACLI command | Function |
|---|---|
| NETWORKAREASLIST | Get-PVNetworkArea |
| ADDNETWORKAREA | New-PVNetworkArea |
| MOVENETWORKAREA | Move-PVNetworkArea |
| RENAMENETWORKAREA | Rename-PVNetworkArea |
| DELETENETWORKAREA | Remove-PVNetworkArea |
| ADDAREAADDRESS | New-PVNetworkAreaAddress |
| DELETEAREAADDRESS | Remove-PVNetworkAreaAddress |
| TRUSTEDNETWORKAREASLIST | Get-PVTrustedNetworkArea |
| ADDTRUSTEDNETWORKAREA | Add-PVTrustedNetworkArea |
| ACTIVATETRUSTEDNETWORKAREA | Enable-PVTrustedNetworkArea |
| DEACTIVATETRUSTEDNETWORKAREA | Disable-PVTrustedNetworkArea |
| DELETETRUSTEDNETWORKAREA | Remove-PVTrustedNetworkArea |
Requests and passwords
| PACLI command | Function |
|---|---|
| REQUESTSLIST | Get-PVRequest |
| REQUESTCONFIRMATIONSTATUS | Get-PVRequestStatus |
| CONFIRMREQUEST | Set-PVRequestStatus |
| DELETEREQUEST | Remove-PVRequest |
| GENERATEPASSWORD | New-PVPassword |
Notable changes are recorded in the Changelog.
- Pete Maan - pspete
MIT. See LICENSE.md.
Contributions are welcome. See CONTRIBUTING.md.
