J'ai essayé d'obtenir les étapes que le script ne dans un fichier txt, mais je ne peux pas obtenir ma tête autourJe veux obtenir un fichier journal de ce que mon script Powershell fait exactement?
$days = -2
$date = (get-date).adddays($days)
$lastboot = (Get-WmiObject Win32_OperatingSystem).LastBootUpTime
$Computer = Get-ADComputer -SearchBase 'OU=TEST-OU,OU=EDV,DC=Kolbe-Druck,DC=de' -Filter '*' | Select -EXP Name
$lastbootconverted = ([WMI]'').ConvertToDateTime($lastboot)
write-host $date
write-host $lastboot
write-host $lastbootconverted
if($date -gt $lastbootconverted)
{
write-host Need to reboot
(Stop-Computer $Computer -Force)
}
else
{
write-host no need to reboot
}
des conseils?
Start-Transcript? https://technet.microsoft.com/en-us/library/hh849687.aspx –