1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| clear
Function Get-Lastboot {
"--- Last boot ---"
gwmi -Class WIN32_OperatingSystem |
select CSName,Caption,@{n="Last Booted";e={[Management.ManagementDateTimeConverter]::ToDateTime($_.LastBootUpTime)}}
Write-Host " "
"--- last boot ---"
}
function Get-ServiceDown {
"--- services ---"
Get-Service |
select Status, Name, StartType |
where {$_.Status -like "Stopped" -and $_.StartType -like "Automatic" }
"--- services ---"
}
function Get-diskinfo {
"--- disk info ---"
$disks = Get-WmiObject Win32_LogicalDisk | Select-Object Name,Size,FreeSpace
foreach ($disk in $disks){
"-- " + $disk.Name + " --"
"FreeSpace (GB) " + [math]::Round($disk.FreeSpace/1GB,2) # exprime en GB avec 2 chiffres après la ,
"Size (GB) " + [math]::Round($disk.Size/1GB,2) # exprime en GB avec 2 chiffres après la ,
"Free % " + [math]::Round($disk.FreeSpace*100/$disk.Size,2)
}
"--- disk info ---"
}
Get-ServiceDown
Get-diskinfo
Get-Lastboot |
Partager