Skip to content

Instantly share code, notes, and snippets.

@luksi1
Created September 12, 2018 07:14
Show Gist options
  • Save luksi1/7bbae3edf1543304a70430fe4d67ce71 to your computer and use it in GitHub Desktop.
Save luksi1/7bbae3edf1543304a70430fe4d67ce71 to your computer and use it in GitHub Desktop.
function test {
[cmdletbinding()]
param(
[parameter(mandatory)]
[validatescript({test-computer $_})]
[string] $computername
)
write-host $computername
}
function test-computer {
[cmdletbinding()]
param(
[parameter(mandatory,valuefrompipeline,position=0)]
[string] $computername
)
$computers = get-adcomputer -filter * | Where-object name -eq $computername
$computers.name -contains $computername
}
test -computername "WIN10"
test -computername "FIN10"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment