Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function test{
- param(
- [string[]]$ComputerName = 'localhost'
- )
- begin{
- }
- process{
- ForEach ($computer in $ComputerName){
- $test = Get-Process -name explorer -ComputerName $ComputerName | Select-Object -Property id
- switch ($test)
- {
- 1 {$test = "The answer is 300"}
- 5096 {$test = "the answer is 5096"}
- 3 {$test = "the answer is 321"}
- default {"The answer is none"}
- }
- $obj = [pscustomObject]@{
- $ComputerName = $computer
- Test = $test
- }
- }
- }
- end{
- Write-Host ("answer = $obj")
- }
- }
- test
Advertisement
Add Comment
Please, Sign In to add comment