This task sequences works with Windows 10 for most laptop and desktops, it also deal with WIFI and do software installation, hopefully it can be useful for you.

0. Overview

SCCMW10


This is my task sequence for windows OSD, it contains four parts,
1. Valiadation
Which setup the password and several variables, it will verify the user to kick off the start of OSD.
2. Installation
This is OSD part, it will choose different OU and computer names depends on user 's choice
3. Driver installation
4. Setup Opertating system
This will run some scripts to complete the installation, it is customized to format what we have in school.

0. Overview

 

Part 1. 1. Valiadation


 

1.1

1.2

1.3

1.4.1.1

1.4.1.2

<html>
<head>
<title>Prompt for password</title>
<HTA:APPLICATION 
     ID="objAutoRefresh"
     APPLICATIONNAME="Auto Refresh"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="maximize"
     icon="icon.ico"
     SHOWINTASKBAR="no"
     SYSMENU="no"
>
<link rel="stylesheet" type="text/css" href="/skin.css">
</head>
<SCRIPT LANGUAGE="VBScript">
on error resume next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set objOSD = CreateObject("Microsoft.SMS.TSEnvironment")
Set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI") 
oTSProgressUI.CloseProgressDialog 
Set oTSProgressUI = Nothing

Sub Window_Onload
   PasswordArea.Focus
End Sub

Sub RunScript
	If PasswordArea.value <> objOSD("Password") Then
			Exit Sub
	Else
		on error resume next
	 	objOSD("ALLOWOSDBUILD") = "YES"
		
		If PCName.value <> "StudentComputer" Then
		objOSD("OSDType") = "Win10Teacher"
		objOSD("OSDComputerName")=PCName.value 
		Else
		
		objOSD("OSDType") = "Win10Student"
		End IF
 		Set objOSD = Nothing
		window.close()
	End If 
End Sub
Sub KeyMonitor
 If window.event.keyCode = 13 Then
RunScript
         End If

End Sub

</SCRIPT>

<body onkeydown="KeyMonitor">
Please type in password to continue <br>
<input type="password" name="PasswordArea" size="30" >
<input id=runbutton  class="button" type="button" value="GO" name="run_button"  onClick="RunScript">
</p>
For Teacher Computer Rename Below </p>
<input Name=PCName Value="StudentComputer">(Keep Unchanged for student computer)</input>

</body>
</html>

 

 

1.4.2

<job id="setEnv">
  <script language="VBScript" src="/..\ZTIUtility.vbs"/>
  <script language="VBScript">

Dim oTSProgressUI
set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
oTSProgressUI.CloseProgressDialog()


  	On error resume next
	Dim fso, WShell, oFile
	Set WShell = CreateObject("WScript.Shell")
	Set fso = CreateObject("scripting.filesystemobject")

	scriptroot = oEnvironment.Item("SCRIPTROOT")

	MsgBox "Please click OK to shutdown the computer.",0, "Task Sequence Aborted"
	WShell.Run "wpeutil shutdown",0, True 

  </script>
</job>

 

Part 2 OSD


2.1

2.2.1

2.2.2

2.3.1

2.3.2

2.3.3.1

2.3.3.2

<html>
<head>
<title>PC Information</title>
<HTA:APPLICATION 
     ID="objAutoRefresh"
     APPLICATIONNAME="Auto Refresh"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
     icon="icon.ico"
     SHOWINTASKBAR="no"
     SYSMENU="no"
>
<link rel="stylesheet" type="text/css" href="/skin.css">
</head>


<SCRIPT LANGUAGE="VBScript">

On Error Resume Next

Set WshShell = CreateObject("WScript.Shell")
Set objOSD = CreateObject("Microsoft.SMS.TSEnvironment")
Set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI") 
oTSProgressUI.CloseProgressDialog 
Set oTSProgressUI = Nothing
Dim dtmStartTime


Sub Wait(Time)
Dim wmiQuery, objWMIService, objPing, objStatus
wmiQuery = "Select * From Win32_PingStatus Where Address = '1.1.1.1' AND Timeout = " & Time
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objPing = objWMIService.ExecQuery(wmiQuery)
For Each objStatus in objPing
Next
End Sub
  
Sub Window_Onload
    width = "600"
	height = "400"
	' This moves the window to the middle of the screen
	window.resizeTo width,height 
	window.moveTo 0, 0
    
	serialNumber.Value=objOSD("SERIALNUMBER")
	make.Value=objOSD("MAKE")
	model.Value=objOSD("MODEL")
	
	if Left(objOSD("MODEL"),3) = "20C" THEN
    objOSD("BSCPCMODEL") = "YOGA2"
	addtionalInfo.Value = "This PC is YOGA 2"
	End if
	
	if Left(objOSD("MODEL"),3) = "20F" THEN
    objOSD("BSCPCMODEL") = "YOGA260"
	addtionalInfo.Value = "This PC is YOGA 260"
	End if
	
	if Left(objOSD("MODEL"),3) = "20D" THEN
    objOSD("BSCPCMODEL") = "YOGA11E"
	addtionalInfo.Value = "This PC is YOGA 11E"
	End if

	
	dim sn
	sn=Replace(objOSD("SERIALNUMBER")," ","")
	
	if  Len(sn) > 7 	THEN 
	sn=Right(sn,7)
	addtionalInfo.Value = "This PC has SN more than 7 digits, which will be trimmed"
	End if
	
	pcName.Value="Win10-" & sn
	objOSD("SERIALNUMBER") = sn
	Wait(30000)
	Set objOSD = Nothing
    window.close()
	
	
End Sub
 
Sub PAUSE
Wait(60000)
End Sub
 
Sub SHUTDOWN
 Set OpSysSet = GetObject("winmgmts:{authenticationlevel=Pkt," _
    & "(Shutdown)}").ExecQuery("select * from Win32_OperatingSystem where "_
     & "Primary=true")
for each OpSys in OpSysSet
retVal = OpSys.Win32Shutdown(6)
next
 End Sub



</script>

<body>
<table>
<tr><td>THIS TABLE WILL DISAPPEAR IN 30 SECONDS</td></tr>
<tr><td>MAKE:</td><td><input Name=make></input></td></tr>
<tr><td>MODEL:</td><td><input Name=model></input></td></tr>
<tr><td>SERIAL NUMBER:</td><td><input Name=serialNumber></input></td></tr>
<tr><td><input Name=pcName ></input></td></tr>
<tr>
<td>ADDITIONAL INFORMATION</td>
<td><input Name=addtionalInfo style="color:red;"></input></td>
</tr>
<tr>
<td><a href="#" class="BSCButton" onclick="PAUSE">PAUSE</a></td>
<td><a href="#" class="BSCButton" onclick="SHUTDOWN">SHUTDOWN</a></td>
</tr>
</table>
</body>

 

 2.4

2.4A

2.5

2.6

2.7.1

2.7.1A

2.7.2

2.7.2A

Part 3 Drivers


3.1.1

3.1.1A

3.1.7

3.1.7A

3.2

PART 4, Setup Windows


4.1

4.2

@echo off
SETLOCAL

echo -------------Reimage - Serialization Log Start--------------------------  >> c:\system.log  2>&1 
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) >> c:\system.log  2>&1 
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
echo Start Serialization at %mydate%_%mytime% >> c:\system.log  2>&1
"c:\windows\setup\scripts\Adobe.exe" --tool=VolumeSerialize --provfile="c:\windows\setup\scripts\prov.xml" >> c:\system.log  2>&1
reg import "c:\windows\setup\scripts\Google.reg"
echo ------------Reimage - Serialization Log End-------------------------  >> c:\system.log  2>&1 

certutil -importpfx -p <<YourPassWord>> "c:\windows\setup\scripts\<<YourCert>>.pfx"
netsh wlan add profile filename="c:\windows\setup\scripts\Win10.xml"
netsh wlan connect name="<<YourWIFIName>>"

 4.3

4.4.B

4.4.BC

This is needed for certain computers only, I found they are not joining domain through normal steps, so I have add this following Scripts to make sure it join domain.

 

on error resume next

Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")

strDomain = "<<DomainName>>" 
strPassword = "<<YourPassWord>>" 
strUser = "<<UserName>>" 
strOU = "<<OUDetails>>" 
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName


Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, strOU, _
JOIN_DOMAIN + ACCT_CREATE + DOMAIN_JOIN_IF_JOINED)
 
Select Case ReturnValue
 
Case 0 Status = "Success"
 
Case 2 Status = "Missing OU"
 
Case 5 Status = "Access denied"
 
Case 53 Status = "Network path not found"
 
Case 87 Status = "Parameter incorrect"
 
Case 1326 Status = "Logon failure, user or pass"
 
Case 1355 Status = "Domain can not be contacted"
 
Case 1909 Status = "User account locked out"
 
Case 2224 Status = "Computer Account allready exists"
 
Case 2691 Status = "Allready joined"
 
Case Else Status = "UNKNOWN ERROR " & ReturnValue
 
' Show Status
MSGBOX "Join domain status: " & Status
 End Select

 

4.4

4.4A

 

4.7

 

@echo off
echo ---------------------Image Log Start--------------------------  >> c:\System.log  2>&1 
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) >> c:\System.log  2>&1 
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b) >> c:\System.log  2>&1
echo This computer has been imaged at %mydate%_%mytime% >> c:\System.log  2>&1
echo ----------------------Image Log End-------------------------  >> c:\System.log  2>&1 

 

4.9

 

Hopefully this is useful for you.


 

 

 

 

About Lei

I am an IT specialist with over 10 year experience - years on Automation, on-Premise or Azure.

I am happy to develop however never want be a full time developer. Only do what I have to do. If it has to be PowerShell,HTML, PHP, CSS, C#, VBS or JS, front end or backend, so be it, doesn't matter!

Spent years with Windows, SCCM, SharePoint, SQL and Exchange servers. For last several years, I have been actively working under On Premise > Azure environment.

THERE IS NO WAY BACK!!!

Current Certificates:
    Microsoft® Certified-
  • -Enterprise Administrator
  • -Database Administrator
  • -SharePoint Administrator
  • -Administering and Deploying SCCM 2012
Red Hat Certified Technician
ITIL V3 Foundation - Practitioner

Working on Azure Certificates now and hopefully they can stop upgrading their questions one day! GIVE ME A BREAK!

Contact Lei

Name *
Email *
Comments *

Traffic since 10/08/2016

Today13
Yesterday83
This week637
This month1933
Total416293

Visitor Info

  • IP: 54.221.73.186
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

1
Online

2017-12-17

Login