Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

check servers for services and volumes export result as true or false

$
0
0

Howdy,

I am trying to modify a query that writes the result of a query to a csv file.  The script will look for a service and I had it check the startup mode and write that out. But now I need to just check for the service and if the service exists I need to write to a column true and if not exists then it should be false.

I am working on how to get the volume type on the list of servers but if anyone can help me, I need to know if the volumes are ntfs or not. I am sure they are but I have to prove that. 

param (

[string[]]$ServerArray = (Get-Content -Path s:\scripts\serverlist.txt),

[string]$SaveLocation = "s:\scripts\results.csv"

)

if (-not (Test-Path -Path $SaveLocation)) {

New-Item -ItemType directory -Path $SaveLocation

}

$CurrentLogFile = Join-path -Path $SaveLocation -ChildPath 'results.csv'

Foreach ($Server in $ServerArray ) {

"Querying Services for $Server" 

Get-WmiObject win32_service -ComputerName $Server -Filter "Name='wauserv'" | Select Name,

} | Sort-Object "Name" | Export-Csv -Path $CurrentLogFile -NoTypeInformation -Append

}

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles