Here's the scoop. I've got an MDT Task Sequence setup to run this PoSH script I created for our enterprise environment. Since we are scattered with A LOT of different IT Specialists in branch
offices using a central deployment share updated by a robocopy script every quarter, I would like to capture the user who authenticates into the MDT Deployment share so we as admins can communicate with them that they need to update their driver database
for the specific model with driver bangs.
Can anyone think of a way to capture and store the username of the individual connected to the deployment share at the time of imaging?
Thanks!
<#
.SYNOPSIS
Emails admin of missing drivers post-deployment
.DESCRIPTION
Queries the PNPEntity WMI Class for devices with an exclamation point and also uses the ComputerSystemProduct
class to gather actual hardware vendor information relevant to finding the correct drivers for MDT
.AUTHOR
Karson
v1.0
1/31/2012
.EXAMPLE
./QueryBadDevices.ps1
#>
$badDevices = Get-WmiObject Win32_PNPEntity | where {$_.ConfigManagerErrorcode -ne 0}
$systemName = $env:computername
$systemInfo = Get-WmiObject Win32_ComputerSystemProduct
$systemOS = Get-WmiObject Win32_OperatingSystem
$systemIP = Get-WmiObject Win32_NetworkAdapterConfiguration | where {$_.IPAddress } | Select -ExpandProperty IPAddress | Where { $_ -like '10.*' }
$systemOSArchitecture = $systemOS.OSArchitecture
$systemOSVersion = $systemOS.Caption
$systeminfoSerial = $systemInfo.IdentifyingNumber
$systeminfoVendor = $systemInfo.Vendor
$systeminfoName = $systemInfo.Name
$recipients = "My email"
$SMTPserver = "smtp server"
foreach ($device in $badDevices) {
if ($device.description -ne ('Standard PS/2 Keyboard' -or 'PS/2 Compatible Mouse')) {
$deviceDescription = $device.description
$deviceID = $device.DeviceID
Send-MailMessage `
-from "MDT2010@domain" `
-to $recipients `
-subject "$systeminfoVendor $systeminfoName Missing Drivers" `
-smtpServer $SMTPserver `
-body ("Vendor: $systeminfoVendor" + "`nModel: $systemInfoName" + "`nSerial: $systeminfoSerial" + "`nOS Information: $systemOSVersion $systemOSArchitecture"+ "`n`nComputer Name: $systemName" + "`nIP: $systemIP" + "`n`nMissing Device: $deviceDescription" + "`nDeviceID: $deviceID")
}
}