Skip to content
PowerShell Secure / Self-Verifying Library Demo
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PowerShell Secure / Self-Verifying Library Demo

Copy the complete module folder Secure-ChainKit to one of the module folders defined in $env:PSModulePath

Import the Secure-Chainkit module

PS C:\Users\SecureUser> Import-Module -Name Secure-ChainKit

Start by autheticating to the Chainkit service.

The Connect-CKService cmdlet requires a PSCredential to be passed.

Some ways to create such a PSCredential object.

  • from a JSON file
# Get Credentials from a JSON file
$credJson = Get-Content -Path .\credentials.json | ConvertFrom-Json
$pswdSec = $credJson.password | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $credJson.user, $pswdSec
  • from an Environment variable
# Get Credentials from Environment Variables CKUSER/CKPASS
$pswdSec = $env:CKPASS | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:CKUSER, $pswdSec
  • from prompting the user
# Get Credentials Interactively from User
$cred = Get-Credential

Now you are ready to connect to the Chainkit service

# Connect to ChainKit
Connect-CKService -Credential $cred | Out-Null

Once connected, you can protect a .ps1 script.

# Protect a Script
PS C:\Users\SecureUser> Protect-CKScript -Path 'C:\Path-To\helloworld.ps1'

You can now execute this protected script. When the script has been tampered with, the script will stop with a message.

# Execute Hardened Script
PS C:\Users\SecureUser> C:\Path-To\Secure-helloworld.ps1


We hope you enjoyed using this. Please send all comments and feedback to

You can’t perform that action at this time.