Highlighted
normand Trusted Contributor.
Trusted Contributor.
237 views

Script to determine disk mode and device model

Hi,
I have a mix of computers in MBR mode (over 800) and EFI mode (newer devices, 50-100).
I would like to make a script that would determine, depending on the mode of the disk and the model of the computer (BIOS information), to push the right data image and the right drivers image.
I use the same image of the DATA partition for MBR and EFI images.
Can someone help me on creating that script to do what I need ?
Thanks for help.
Normand
Labels (1)
0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

Re: Script to determine disk mode and device model

The following Script will capture Make/Model/Vendor info.....it's a batch file....
Can Tweak as you like....Reminder: The location of Make/Model/Vendor info is stored in semi-random locations and varies from vendor to vendor and even model to model for some vendors...
However, the needed data should be in one of the fields captured below...

---

@echo off
for /f "tokens=2 delims==" %%f in ('wmic csproduct get name /format:value') do set CSPNAME=%%f
for /f "tokens=2 delims==" %%f in ('wmic csproduct get vendor /format:value') do set CSPVENDOR=%%f
for /f "tokens=2 delims==" %%f in ('wmic csproduct get version /format:value') do set CSPVERSION=%%f
for /f "tokens=2 delims==" %%f in ('wmic computersystem get manufacturer /format:value') do set CSMANUFACTURER=%%f
for /f "tokens=2 delims==" %%f in ('wmic computersystem get model /format:value') do set CSMODEL=%%f
set csall= %CSPNAME% %CSPVENDOR% %CSPVERSION% %CSPMANUFACTURER% %CSMODEL%

for /f "tokens=2 delims==" %%f in ('wmic bios get SMBIOSBIOSVersion /format:value') do set BIOSVersion=%%f
for /f "tokens=2 delims==" %%f in ('wmic bios get ReleaseDate /format:value') do set BIOSDate=%%f

set cs
set BIOS

if not "%csall%"=="%csall:XPS 8910=%" echo match 8910
if not "%csall%"=="%csall:XPS 8920=%" echo match 8920
if not "%csall%"=="%csall:XPS 8930=%" echo match 8930
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Script to determine disk mode and device model

The following Powershell Script captures UEFI/BIOS bootinfo among other data...

$ZESM = (gi $env:ZENworks_home\esm\zesservice.exe).versioninfo.fileversion
$OS_VERSION = (Get-ItemProperty -Path "hklm:software\microsoft\Windows NT\CurrentVersion").ReleaseID
write-host ZESM $ZESM
write-host OS $OS_VERSION
$FDEDriverVersion = (gi c:\windows\system32\drivers\nbfdenc.sys).versioninfo.fileversion
write-host FDEDriver $FDEDriverVersion
$FDEInitVersion = (gi c:\windows\nac\fdeinit.exe).versioninfo.fileversion
write-host FDEINIT $FDEInitVersion
$EncryptionProgress = (Get-ItemProperty -Path hklm:software\Secude\SNB\FDE\EncryptionProgress).ProgressPercent

$NACCount = (Get-Childitem c:\windows\nac).Count

write-host Encrypt $EncryptionProgressWe
$bootcheck = Confirm-SecureBootUEFI -ErrorVariable ProcessError
if ($ProcessError)
{
$boottype="BIOS"
}
else
{
$boottype="UEFI"
}
write-host BootType $boottype
$Results=$env:computername + "," + $OS_VERSION + "," + $BootType + "," + $FDEDriverVersion + "," + $FDEInitVersion + "," + $NACCount + "," + $EncryptionProgress + "," + $ZESM

$Filename=$env:computername + ".csv"
$Results | out-file $Filename
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.