Examples
Example remote scripts for *nix and Windows
Expire a user password
Expires the named user’s password, so that the user must set a new one at next login. Replace cbuser with the account you want to expire.
#!/bin/bash
passwd --expire cbuser
Join a Windows server to an OU
On a Windows server, this executes as PowerShell and joins the server to the given domain and organizational unit. Replace the domain, OU, and account values with your own.
$domain = "example.com"
$ou = "ou=cb_users,dc=example,dc=com"
$duser = "EXAMPLE\Administrator"
$dpwd = "ReplaceWithPassword"
$creds = New-Object System.Management.Automation.PSCredential($duser, (ConvertTo-SecureString $dpwd -AsPlainText -Force))
Add-Computer -DomainName $domain -OUPath $ou -Credential $creds
This example holds a domain password in plain text to keep it short. In practice, supply the password as an action input rather than writing it into the script. See Action input parameters.
Related
- Write remote scripts: shebangs, parameterization, and return codes.
- OS-specific requirements: preparing the target server.