How To Obtain Computer Serial Number With PowerShell

To obtain the local computer serial number, use this one-liner PowerShell command:

get-wmiobject -Class win32_bios | select PSComputerName,SerialNumber

To obtain the serial number of a remote computer, use this one-liner PowerShell command (PSRemoting must be enabled:

get-wmiobject -ComputerName <name of computer> -Class win32_bios | select PSComputerName,SerialNumber

Please like & share:

Configure PowerShell Remoting

To perform actions on remote computers using PowerShell, you’ll need to setup PowerShell Remoting. Here are the steps:

1. In a PowerShell CMD window that is running under the administrator context, run the following command:

Enable-PSRemoting –force

2. Configure WinRM to run automatically:

Set-Service WinRM -StartMode Automatic

3. Verify the start mode was set correctly and that it is currently running:

Get-WmiObject -Class win32_service | Where-Object {$_.name -like “WinRM”}

4. Configure so that all remote hosts are trusted:

Set-Item WSMan:localhost\client\trustedhosts -value *

5. Verify that the remote trusted hosts has taken effect:

Get-Item WSMan:\localhost\Client\TrustedHosts

Written by myITforum

Please like & share: