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