I am currently using a script to pull information from monitors such as Manufacturer, Model, and Serial Number. At the moment the script exports the file to a folder that has already been created. I am needing to modify the script so it can automatically create the folder and file.
Script:
$Monitors = Get-WmiObject WmiMonitorID -Namespace root\wmi
$LogFile = "C:\test\monitors.txt"
function Decode {
if ($args[0] -is [System.Array]){
[System.Text.Encoding]::ASCII.GetString($args[0])
}
Else {
"Not Found"
}
}
echo "Manufacturer", "Name", "Serial Number"
ForEach ($Monitor in $Monitors) {
$Manufacturer = Decode $Monitor.ManufacturerName -nomatch 0
$Name = Decode $Monitor.UserFriendlyName -nomatch 0
$Serial = Decode $Monitor.SerialNumberID -nomatch 0
echo "$Manufacturer, $Name, $Serial" >> $LogFile
}