Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Computer Rename using Win32_Baseboard Serial number

Reply
 
Old 3 Weeks Ago   #1 (permalink)
Mark


 
 

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 SpecsSystem Spec
Old 3 Weeks Ago   #2 (permalink)
Martin Zugec


 
 

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 SpecsSystem Spec
Old 3 Weeks Ago   #3 (permalink)
RichS [MVP]


 
 

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 SpecsSystem Spec
Old 3 Weeks Ago   #4 (permalink)
Ant


 
 

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 SpecsSystem Spec
Old 3 Weeks Ago   #5 (permalink)
Mark


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46