Jump to content

Recommended Posts

Posted

Hi all

 

Not the best with Powershell but at [preent we are gopingt o each machine one by one and running wmic bios get serialnumber so we can update our audit

 

Is there a way i can do this centrally so i can run a script and its all PC name and serial number? I have sccm but cant seem to find from there too

 

thanks

Posted

You can do this is SCCM by:

 

Going to Assets and Compliance > Devices

Right click column headers and add the information you need (serial number)

Ctrl + A

Ctrl + C

Paste into Excel / Notepad

Posted (edited)

Hey

 

Here is a PowerShell script that works for us. Note that the devices must all be on the LAN, as it uses WMI/CIS instances to grab the data.

 

Place all of the computer names in a CSV file with the header "AssetTag", and change the path in the script.

 

$Assets = Import-CSV -Path ".\input.csv";

$AssetsWithSerialNumber = @();

foreach($Asset in $Assets)
{
   $AssetTag = $Asset.AssetTag;

   $SerialNumber = (Get-CimInstance -Class Win32_BIOS -ComputerName $AssetTag | Select-Object SerialNumber).SerialNumber;

   $AssetWithSerialNumber = [PSCustomObject]@{
       AssetTag = $AssetTag
       SerialNumber = $SerialNumber
   };

   $AssetsWithSerialNumber += $AssetWithSerialNumber;
}

$AssetsWithSerialNumber | Export-CSV -Path ".\output.csv" -NoTypeInformation

 

Edit: If you want to get every AD computer, you should just be able to replace the first line with:

$Assets = Get-ADComputer -Filter * | ft Name

and replace any reference to AssetTag with Name.

Edited by Ellisio
Posted (edited)
Hi all

 

Not the best with Powershell but at [preent we are gopingt o each machine one by one and running wmic bios get serialnumber so we can update our audit

 

Is there a way i can do this centrally so i can run a script and its all PC name and serial number? I have sccm but cant seem to find from there too

 

thanks

 

You can use a Query in SCCM. Monitoring -> Queries -> Create Query.

 

I use the folllowing for Windows 10 to get basic info.

 

select SMS_G_System_COMPUTER_SYSTEM.Name, SMS_G_System_COMPUTER_SYSTEM.Manufacturer, SMS_G_System_COMPUTER_SYSTEM.Model, SMS_G_System_OPERATING_SYSTEM.Version, SMS_G_System_DISK.Size, SMS_G_System_X86_PC_MEMORY.TotalPhysicalMemory, SMS_G_System_PROCESSOR.Name, SMS_G_System_PC_BIOS.SerialNumber, SMS_R_System.LastLogonUserName from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_COMPUTER_SYSTEM as Make on Make.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_DISK on SMS_G_System_DISK.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_X86_PC_MEMORY on SMS_G_System_X86_PC_MEMORY.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_PROCESSOR on SMS_G_System_PROCESSOR.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_PC_BIOS on SMS_G_System_PC_BIOS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.Name like "%Windows 10%" order by SMS_G_System_COMPUTER_SYSTEM.Name

 

When you run the query, you can easily filter the results, or copy and paste into Excel.

Edited by altecsole

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...