| 1234567891011121314151617181920 |
- $stringOutput = quser 2>$null
- If (!$stringOutput) {
- Write-Warning "Unable to retrieve quser info for `"$Comp`""
- }
- $out = (($stringOutput -split "\n" -replace "SESSIONNAME", "") -replace "rdp-tcp#[0-9]+", "") -replace '\s\s+', ';'| convertfrom-csv -Delimiter ';'
- $out | ForEach-Object {
- If($_."IDLE TIME" -eq ".") {
- $_."IDLE TIME" =[TimeSpan]::Parse("0")
- return
- }
- If($_."IDLE TIME" -like "*:*") {
- $_."IDLE TIME" = [TimeSpan]::Parse($_."IDLE TIME")
- } else {
- $_."IDLE TIME" = [TimeSpan]::Parse("0:"+$_."IDLE TIME")
- }
- }
- $out
|