An Engineers Notebook

Warranty Checker PowerShell Script


You need a list of all recently logged on computers to a network with the person who logged on, the computer they logged onto, the time and date and the serial number of the computer for warranty reasons.


First change the “HVDC1” part to ensure that it contains the server name of the locations where the ‘logs’ share is. Deploy this script via Group policy and create a share called “logs” on the 

$hostname = "HVDC1"$logfile = "\$hostnamelogsicu.csv"$username = $env:UserName$computername = $env:computername$serialnumber = get-WmiObject -Class Win32_Bios | Select-Object SerialNumber$date = Get-Date$spacer = "=================================================================="$username | Out-File -FilePath $logfile -Append -NoClobber$computername | Out-File -FilePath $logfile -Append -NoClobber$date  | Out-File -FilePath $logfile -Append -NoClobber$serialnumber  | Out-File -FilePath $logfile -Append -NoClobber$spacer | Out-File -FilePath $logfile -Append -NoClobber(gc $logfile) | ? {$_.trim() -ne "" } | set-content $logfile

Leave a Reply

Your email address will not be published.