Click the Details tab to begin entering the custom Windows PowerShell script. The Run .Net Script activity allows for C#, Javascript, VB.NET and PowerShell scripts to be executed. Be sure to select PowerShell as the scripting option.
In the Script field enter in the following Windows PowerShell script:
$Session = New-PSSession -ComputerName localhost
$ReturnArray = Invoke-Command -Session $Session -ScriptBlock
{
$username = 'pureuser'
$pwd = ConvertTo-SecureString -String 'pureuser' -AsPlainText -Force
$Creds = New-Object System.Management.Automation.PSCredential ($username, $pwd)
$FlashArray = New-PfaArray -EndPoint 10.1.1.10 -Credentials $Creds –IgnoreCertificateError
New-Item -Path 'C:\Temp\Orchestrator-Log.txt' -ItemType 'File'
New-PfaVolumeSnapshots -Array $FlashArray -Sources “Volume1" -Suffix “Suffix1" | Add-Content -Path 'C:\Temp\Orchestrator-Log.txt'
}
Note:
By default, the Run .Net Script activity runs scripts with Windows PowerShell 2.0; this lacks many of the new features found in PowerShell 3.0, 4.0 and 5.0. So in order to workaround this limitation a New-PSSession is created on the server which hosts the Runbook and will execute with the latest version of PowerShell installed on the host.