A
Alper Akkuş
Guest
I added following powershell command to scheduled tasks to check for computers that are turned on every night.
I don't want to count how many "true" counts there are for this csv file in total. Is there any command I can add to file or as name of file, how many "true" in total?
Also, how do I send these csv files by email each time they occur?
$props = @{
Date = Get-Date
ComputerName =''
Online = $false
}
Get-ADComputer -Filter * | ForEach {
$props.Online = $false
$props.ComputerName = $_.Name
If (Test-Connection $_.Name -Count 1 -Quiet) {
$props.Online = $true
}
New-Object PsObject -Property $props
} | Export-Csv C:\Users\User\Desktop\OnlinePC_$((Get-Date).ToString('dd-MM-yyyy_HH-mm')).CSV -NoTypeInformation
Continue reading...
I don't want to count how many "true" counts there are for this csv file in total. Is there any command I can add to file or as name of file, how many "true" in total?
Also, how do I send these csv files by email each time they occur?
$props = @{
Date = Get-Date
ComputerName =''
Online = $false
}
Get-ADComputer -Filter * | ForEach {
$props.Online = $false
$props.ComputerName = $_.Name
If (Test-Connection $_.Name -Count 1 -Quiet) {
$props.Online = $true
}
New-Object PsObject -Property $props
} | Export-Csv C:\Users\User\Desktop\OnlinePC_$((Get-Date).ToString('dd-MM-yyyy_HH-mm')).CSV -NoTypeInformation
Continue reading...