/build/static/layout/Breadcrumb_cap_w.png
04/05/2017 1454 views
Newbie question new to KACE and Powershell,  but I have been searching and reading for a while now and cannot figure out how to format so I only get serial number value from bios.
Using 1st part of script below I get     "Serialnumber  :  1GXBJL1"
where all I want is the    "1GXBJL1"   that I can pass to 2nd part.

# Getting the Serial Number from Bios and Outputting to Defined Variable.
gwmi win32_bios | Format-List serialnumber -OutVariable CN

# Renaming..
Rename-Computer -NewName "$CN" -Restart

Thanks in advance.
Mark

2 Comments   [ + ] Show comments

Comments

  • I'm on Mac OS X so I can't test right now but try this for the first line:

    $CN = (gwmi win32_bios).serialnumber
  • That did the trick I had tried it outputed only the serial number as a clean value. Thanks

All Answers

0
That did the trick. It pulled the Serial number out as a value. That value was then used to rename computer. All of our Pc's are Dell's and they already have a unique serial number in bios so we use that for our computer names. 
Here is clean copy of final script.

Answered by 


I was just trying to clean up a final answer for others to read

  • # Getting the Serial Number from Bios and Outputting to Defined Variable.
$CN = (gwmi win32_bios).serialnumber
# Renaming computer to above serial number value    aka Dell Service Tag
Rename-Computer -NewName "$CN" -Restart
Answered 04/06/2017 by: mark.adams
White Belt