Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Get-Service, Property Status, Verständnisfrage,

$
0
0

hallo Zusammen

ich habe gerade aus einem Buch ein Beispiel abgetippt, bei dem bei Get-Service das Property "Status" der Zahlenwert 1-4 ausgegeben wird.

$_.status


$excel = New-Object -ComObject Excel.Application
$workbook = $excel.workbooks.add()
$excel.visible = $true
$excel.cells.item(1,1) = "Service Name"
$excel.cells.item(1,2) = "Service Status"
$excel.cells.item(1,3) = "Service Status"

$i = 2
Get-Service |
    foreach{
        $excel.cells.item($i,1) = $_.Name
        $excel.cells.item($i,2) = $_.status
        $excel.cells.item($i,3) = "$($_.status)"
        $i=$i+1

    }

wenn ich das gleiche abgekürzt mache kommt ich der Langtext "started oder stopped"? Ich finde keinen Unterschied.

  Get-Service |
    foreach{
        $_.status"$($_.status)"
     }


Chris



Viewing all articles
Browse latest Browse all 2314


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