![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Computer Rename using Win32_Baseboard Serial number Hey All, I am new to powershell and I am trying to rename my Windows 7 laptop using powershell. I have the following script and it's not working. Does anyone know where I am going wrong? I wish to rename the computer using the SerialNumber from W32_Baseboard. Function Rename-ComputerName ([string]$NewComputerName){ $ComputerName = Get-WmiObject -Class Win32_BaseBoard | select SerialNumber $ComputerInfo = Get-WmiObject -Class Win32_computersystem $ComputerInfo.rename("$ComputerName") } Restart-Computer Thanks in advance. Regards, Mark |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Computer Rename using Win32_Baseboard Serial number Hi Mark, don't have a change to try it, however can you try following? Function Rename-ComputerName ([string]$NewComputerName){ [String]$ComputerName = Get-WmiObject -Class Win32_BaseBoard | select SerialNumber $ComputerInfo = Get-WmiObject -Class Win32_computersystem $ComputerInfo.rename("$ComputerName") } Restart-Computer Martin "Mark" <Mark@newsgroup> wrote in message news:B19AA1E0-409C-4963-9705-D2D9FAB25D87@newsgroup Quote: > Hey All, > > I am new to powershell and I am trying to rename my Windows 7 laptop using > powershell. I have the following script and it's not working. Does anyone > know where I am going wrong? I wish to rename the computer using the > SerialNumber from W32_Baseboard. > > Function Rename-ComputerName ([string]$NewComputerName){ > > $ComputerName = Get-WmiObject -Class Win32_BaseBoard | select SerialNumber > $ComputerInfo = Get-WmiObject -Class Win32_computersystem > $ComputerInfo.rename("$ComputerName") > > } > Restart-Computer > > Thanks in advance. > > Regards, > > Mark |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Computer Rename using Win32_Baseboard Serial number One thing to check is that the serial number is actually returned on your machine. On my laptop it isn't returned PS> Get-WmiObject -Class Win32_BaseBoard Manufacturer : Wistron Model : Name : Base Board SerialNumber : SKU : Product : 303C -- Richard Siddaway All scripts are supplied "as is" and with no warranty PowerShell MVP Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Mark" wrote: Quote: > Hey All, > > I am new to powershell and I am trying to rename my Windows 7 laptop using > powershell. I have the following script and it's not working. Does anyone > know where I am going wrong? I wish to rename the computer using the > SerialNumber from W32_Baseboard. > > Function Rename-ComputerName ([string]$NewComputerName){ > > $ComputerName = Get-WmiObject -Class Win32_BaseBoard | select SerialNumber > $ComputerInfo = Get-WmiObject -Class Win32_computersystem > $ComputerInfo.rename("$ComputerName") > > } > Restart-Computer > > Thanks in advance. > > Regards, > > Mark |
My System Specs![]() |
| | #4 (permalink) |
| | RE: Computer Rename using Win32_Baseboard Serial number Mark, Try going after - Win32_BIOS | Select SerialNumber Ant "Mark" wrote: Quote: > Hey All, > > I am new to powershell and I am trying to rename my Windows 7 laptop using > powershell. I have the following script and it's not working. Does anyone > know where I am going wrong? I wish to rename the computer using the > SerialNumber from W32_Baseboard. > > Function Rename-ComputerName ([string]$NewComputerName){ > > $ComputerName = Get-WmiObject -Class Win32_BaseBoard | select SerialNumber > $ComputerInfo = Get-WmiObject -Class Win32_computersystem > $ComputerInfo.rename("$ComputerName") > > } > Restart-Computer > > Thanks in advance. > > Regards, > > Mark |
My System Specs![]() |
| | #5 (permalink) |
| | RE: Computer Rename using Win32_Baseboard Serial number It certainly does. One of those Lenovo models that has the serial number in the baseboard not the bios. "RichS [MVP]" wrote: Quote: > One thing to check is that the serial number is actually returned on your > machine. On my laptop it isn't returned > > PS> Get-WmiObject -Class Win32_BaseBoard > > > Manufacturer : Wistron > Model : > Name : Base Board > SerialNumber : > SKU : > Product : 303C > > > -- > Richard Siddaway > All scripts are supplied "as is" and with no warranty > PowerShell MVP > Blog: http://richardsiddaway.spaces.live.com/ > PowerShell User Group: http://www.get-psuguk.org.uk > > > "Mark" wrote: > Quote: > > Hey All, > > > > I am new to powershell and I am trying to rename my Windows 7 laptop using > > powershell. I have the following script and it's not working. Does anyone > > know where I am going wrong? I wish to rename the computer using the > > SerialNumber from W32_Baseboard. > > > > Function Rename-ComputerName ([string]$NewComputerName){ > > > > $ComputerName = Get-WmiObject -Class Win32_BaseBoard | select SerialNumber > > $ComputerInfo = Get-WmiObject -Class Win32_computersystem > > $ComputerInfo.rename("$ComputerName") > > > > } > > Restart-Computer > > > > Thanks in advance. > > > > Regards, > > > > Mark |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Serial Number | Vista security | |||
| Volume serial number | PowerShell | |||
| Getting Serial Number of Computer | PowerShell | |||
| serial number | Vista installation & setup | |||
| What should be used for the serial number? | Vista installation & setup | |||