hello
in my test lab, i created a function to simplify disjoining systems from active directory & placed this function in $pshome\profile.ps1 in all systems.
Function UnJoin {
Write-Host -f y 'Disjoining computer to Domain.....'
$user = "mydomain\user1"
$pass = "P@ssw0rd" | ConvertTo-SecureString -asPlainText -Force
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $user,$pass
Add-computer -WorkgroupName myworkgroup -credential $cred -Restart -force
now later maybe i write down the word disjoin and maybe i write down the word unjoin.
i don't want to write down the entire function twice so that i assign different names to them.
what is the best idea?
thanks in advanced