Powershell – Automating Computer naming during OSD

1) Save the following script as OSDComputerName.ps1 on a networkshare.

I use Hyper-v in my labb and Hyper-v virtual machin gives you over 30 digits of serialnumber and here in this script i want only the four first of them. This is because NetBios computer names can handle a maximum lenght of 15 characters.

$SerialNumber = (Get-WmiObject -Class Win32_BIOS | Select-Object SerialNumber).SerialNumber
$ShortSerialNumber = $SerialNumber.Substring(0,4)
$OSDComputerName = “LABB-” + $ShortSerialNumber
$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$TSEnv.Value(“OSDComputerName”) = “$OSDComputerName”

2) Create a package in sccm but do not create a program. Distribute the package to DP.

3) Edit your TS and create a “Group” before “Apply Windows/Nework Settings” and name it OSDComputerName.

4) Add a “Run Command Line” with the name “Set PowerShell Execution Policy” and paste the following:

powershell.exe -noprofile -command "Set-ExecutionPolicy Bypass LocalMachine" -force

5) Add a “Run command Line” with the name “OSDComputerName.ps1” and paste the following:

powershell.exe -noprofile -file OSDcomputername.ps1

In “Package” section browse for the script we created and saved in a networkshare.

6) Add a “Run command Line” with the name “Revert Powershell Execution Policy” and paste the following:

powershell.exe -noprofile -command "Set-ExecutionPolicy RemoteSigned LocalMachine" -force

Save the TS and test in your test environament.

Lämna ett svar

E-postadressen publiceras inte. Obligatoriska fält är märkta *

Lägg till Internet Explorer 11 i Windows 7 SP1 image

Vi vill tipsa om en bra steg-för-steg guide över hur du kan lägga till Internet Explorer 11 i en referensavbildning för Windows 7 SP1 . Du hittar guiden här: http://www.deploymentresearch.com/Research/tabid/62/EntryId/124/Adding-Internet-Explorer-11-to-your-Windows-7-SP1-reference-image.aspx   Ps.  

Upgrade to Windows 10 using the SCCM 2012 R2 task sequence

System Center Configuration Manager Team Blog gives an early preview of the in-place upgrade to Windows 10 process via the Configuration Manager task sequence. The upgrade scenario is not new,

SCCM / MDT Task Sequence Error code 0x80072F87

Have gotten the Task Sequence error code 0x80072F87 lately and you have no clue of what it means or why your task sequences won’t run even though everything looks OK?