Quantcast
Channel: Spiceworks Community - Latest topics
Viewing all articles
Browse latest Browse all 183486

Piping array to custom cmdlet | Write-Progress error

$
0
0

Trying to make a cmdlet for the first time, all going pretty well so far (it's a simple one), but I'm using Write-Progress for the cmdlet working with multiple computer names. It works when I put a number of computers in its parameter, but if I pipe data to the cmdlet, it throws an error about the Write-Progress..

Powershell
functionGet-IEM{#Deleted help stuff for your convenience [CmdletBinding()]param([Parameter(Mandatory=$true,ValueFromPipeline=$true,HelpMessage="Enter one or more computer names separated by commas, or use a file containing a list of computer names.")][Alias("CN")][string[]]$ComputerName)BEGIN{$table=@()$i=0}PROCESS{foreach($Compin$ComputerName){Write-Progress-Activity"Checking Paths on $Comp"-Status"Computer $i of $($ComputerName.Count)"`-PercentComplete(($i/$ComputerName.Count)*...

Viewing all articles
Browse latest Browse all 183486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>