1 | initial version |
To use PowerShell commands with Jenkins via WinRM, follow these steps:
Example PowerShell script:
$target = "target-machine"
$username = "domain\username"
$password = "password"
$securePassword = ConvertTo-SecureString -AsPlainText $password -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)
Invoke-Command -ComputerName $target -Credential $credential -ScriptBlock {
# Insert PowerShell commands here
}