Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

creating two names for a function instead of creating the same function twice with different names only

$
0
0

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


Viewing all articles
Browse latest Browse all 6937

Trending Articles