How to: Initialize, format and label disks during OSD Task Sequence in SCCM 2012 R2

During a task seuence in Microsoft SCCM 2012 R2, the operating system and applications are installed on the C: drive in most situations. But in some deployments, you definitely want to create more disks. For example, you want to create a D: and E: partition for storing some other data. Maybe for Microsoft SQL or Exchange installation, databases, logfiles or just some other data.

The following script will do all these steps for you during the task sequence. The script initialize, format, partition and label the disks for you….fully automated! 🙂

## Set CD-ROM from E: to X:
Set-WmiInstance -InputObject ( Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'E:'" ) -Arguments @{DriveLetter='X:'}

$disks = Get-Disk | measure
If($disks.Count -eq 2)
{
## Initialize all new disks
Initialize-Disk 1
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
}
elseif($disks.Count -eq 3)
{
## Initialize all new disks
Initialize-Disk 1
Initialize-Disk 2
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
Get-Disk | where {$_.Number -eq "2"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Backup -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
Get-Disk | where {$_.Number -eq "2"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter E
}
else
{
exit
}
exit

The script first checks how many disks are attached to the server.
If there is only one disk attached, you’ll have only a C: drive available after the deployment.
If there are 2 disks attached, you’ll have a C: and D: drive avalailable after the deployment.
If there are 3 disks attached, you’ll have a C:, D: and E: drive available after the deployment.

The CD-ROM drive will alse changed from E: to X:.

2015-12-18_12h30_44    2015-12-18_12h32_27    2015-12-18_12h32_52

2015-12-18_12h34_31    2015-12-18_12h37_51    2015-12-18_12h41_05

2015-12-18_12h41_43

How to: Change computername in Windows Explorer on Windows Server 2012 R2

When you’re are using a lot of virtual machines or environments, it’s somethimes realy usefull to see in what environment or on what server you’re logged in. If created a really nice solution for my servers, basically Remote Desktop Services in different environments, that does exact my I need! I’ve changed the displayname in Windows Explorer to the value “user on server”, for example: “mark on prod-rds-01”.

You can set this new value with Group Policy Preferences or some other scripting.

1.) Create a new GPO in the Group Policy Management Console
2.) Navigate to “User Configuration / Preferences / Windows Settings / Registry
3.) Create a new registry item and browse to the following registry key:
HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/CLSID/{20D04FE0-3AEA-1069-A2D8-08002B30309D}
4.) Change the default REG_SZ value to “%username% on %computername%”
5.) Login to the specific server where you targeted the GPO and open Windows Explorer
6.) The name of your computer has changed to “username on computername”

2015-12-04_11h19_20    2015-12-04_11h20_16    2015-12-04_11h20_48

2015-12-04_11h21_11    2015-12-04_11h21_40    2015-12-04_11h37_48

How to: Removing Windows 8.1 Modern Apps with PowerShell

When you install a default Windows 8.1 machine, there’re a few modern apps available. In some environments, you want
to remove these modern apps for your users.

With the following steps, you can delete specific apps or all the modern apps.

1.) To get a overview off all the package, use the following command:
Get-AppxPackage | ft Name, PackageFullName -AutoSize
2.) Let’s remove the Finance modern app
Remove-AppxPackage -Package Microsoft.BingFinance_3.0.1.172_x64__8wekyb3d8bbwe -Confirm:$false
3.) Return to the start menu and now you’ll see the Finance app is gone
4.) To remove all the modern apps, use the following command:
Get-AppxPackage | Remove-AppxPackage -Confirm:$false

2015-03-13_14h52_51    2015-03-13_15h24_13    2015-03-13_15h24_54

2015-03-13_15h25_13    2015-03-13_15h26_15    2015-03-13_15h26_25

2015-03-13_15h27_21    2015-03-13_15h27_27

How to: Remove “settings” button in Mozilla Firefox

In some scenario’s you want to remove some buttons within the options of Mozilla Firefox. Because there are not that enhanced group policies for Mozilla Firefox, you’ve to script something. In my example I’ve used RES Workspace Manager to distribute the modified files, but you can also use something else. For example: PowerShell, batchfiles or Group Policy Preferences.

You can edit the file userChrome.css in the folder AppData\Roaming\Mozilla\Profiles\<nameofyourprofile>\chrome to tweak the menu settings within Mozilla Firefox. In my example I’ve added the following rule:
/* Remove connection button */
#connectionSettings { display: nome !important; }

When you open Mozilla Firefox the next time, the “Settings” is gone! 🙂

2014-12-31_09h52_20    2014-12-31_09h52_56    2014-12-31_09h56_05

2014-12-31_09h56_55   2014-12-31_09h53_55

How to: Apply Windows updates during OSD with ConfigMgr 2012 R2

During a OS deployment with ConfigMgr 2012 R2, you definitely want to apply the latest Windows updates and patches, for example with Windows Server Update Service (WSUS). You can also integrate WSUS within ConfigMgr 2012 R2, but in this example WSUS is not integrated!!

This example is also very usefull to create a fully patches golden image in ConfigMgr 2012 R2 (Build & Capture). After the task sequence you’ve a fully patches Windows 8.1 machine that you can use for example VDI environments.

1.) Fist open your task sequence
2.) Create a new computer group “Desktops” within the WSUS console (or choose another name, for exmaple: servers, laptops, etc.)
3.) Add a custom group within the task sequence
4.) Add the following steps in your task sequence
Run Command Line:
reg ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate” /v WUServer /t REG_SZ /d http://wsus01.cloud.local:8530 /f
Run Command Line:
reg ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate” /v WUStatusServer /t REG_SZ /d http://wsus01.cloud.local:8530 /f
Run Command Line:
reg ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate” /v TargetGroup /t REG_SZ /d “Desktops” /f
Run Command Line:
reg ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate” /v TargetGroupEnabled /t REG_DWORD /d 1 /f
Run Command Line:
reg ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU” /v UseWUServer /t REG_DWORD /d 1 /f
Run Command Line:
wuauclt.exe /resetauthorization /detectnow
5.) Don’t forget to set the name of your WSUS server and computer group in the commands above!
6.) Create a new package in ConfigMgr 2012 R2 with the following two files in it, located in the MDT 2013 deployment share directory
ZTIUtility.vbs
ZTIWindowsUpdate.wsf
7.) Don’t create a program in this package, but you only have to distribute it to the distribution point(s)
8.) Add a new step “Run Command Line” to the task sequence with the following command:
cscript.exe ZTIWindowsUpdate.wsf
Select the package where the source files are located
9.) Deploy the task sequence to your client collection!

COAU_01    COAU_02    COAU_03

COAU_04    COAU_05    COAU_06

COAU_07    COAU_08    COAU_09

COAU_10    COAU_11    COAU_12

How to: Configure a “Boot to desktop” group policy for Windows 8.1

New in Windows 8.1 is the “Boot to Desktop” feature, where the user can choose not to boot to the Windows Tiles, but directly to the desktop! That’s a really nice feature if you ask me! How can we centrally configure and manage these feature for all my users or just a group of users? Exactly, through a group policy with User Preferences. It’s a user settings, so you could also use RES Workspace Manager for example.

1.) Navigate to your Group Policy Management Console
2.) Create a new Group Policy and disable the Computer Settings
3.) Open the policy and navigate to User Configuration / Preferences / Windows Settings / Registry
4.) Create a new Registry Item
5.)  Choose for Hive “HKEY_CURRENT_USER” and Navigate in the Key Path to:
Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage
6.) The Value name is “OpenAtLogon
6.) Choose the Value type “REG_DWORD
7) The Value data is:
Boots to Desktop = “0”
Boots to Start Menu = “1”
8.) Attach the group policy to a organizational unit(s) and login to your Windows 8.1 machine!

2014-04-16_10h33_44    2014-04-16_10h33_55    2014-04-16_10h35_15

2014-04-16_10h44_40    2014-04-16_10h44_50    2014-04-16_10h45_18

2014-04-16_10h45_31    2014-04-16_10h46_12    2014-04-16_10h46_33

2014-04-16_10h47_03    2014-04-16_10h52_42

How to: Install the Hyper-V Integration Components with ConfigMgr 2012 R2 during OSD

When you’ve to install an operating system in you’re environment, it is easy and usefull to test your OS deployment first in a virtual environment. In my case, it is an Microsoft Hyper-V host server, where I can deploy some virtual machines using ConfigMgr 2012 R2.

One of the important things when deploying a virtual machine within Hyper-V, are the Integration Components (Integration Services). These components installs all the necesarry drivers for that VM. Maybe you want to perform this action during the OS deployment fase (OSD). What steps do you need to make?

1.) First install a new clean Windows 7 VM (in my case it is Windows 7 Service Pack 1)
2.) Insert the Integration Services Setup Disk
Action / Insert Integration Services Setup Disk
3.) Navigate to your Windows Explorer and open the mounted disk
4.) Navigate to the right folder of your architecture, x86 or x64. In my case it is x64.
D:\support\amd64
5.) Copy all the files in this to your Configuration Manager Site Server. In my case E:\Sources\Applications\Level 0\Hyper-V Integration Services x64
6.) The silent installation is not that hard. Just execute setup.exe /? to see all the options.
7.) Create a new package within ConfigMgr 2012 R2 with a normal program
8.) The source location is the location to your folder created in step 5
9.) The command line to perform is setup.exe /quiet /norestart
10.) After succesfully created to new package, don’t forget to distribute it to your distribution point(s)
11.) Now open you task sequence and at the end create a new folder called “Install Applications”
12.) Add a new package to install and select the wright package and program
13.) All you need to do now is deploy a virtual machine
14.) After your virtual machine has succesfully deployed, look at your device manager. All the components are installed.

INTSER_01    INTSER_02    INTSER_03

INTSER_04    INTSER_05    INTSER_06

INTSER_07    INTSER_08

How to: Disable the EU Browser Choice screen in Windows 8 and 8.1

The first time when you boot your new installed Windwos 8 or 8.1 machine, you get the Browser choice screen. In my situation I want to use Internet Explorer and don’t want to let the users choice what browser they are going to use. You can disable the browser choice screen with a simple registry key. You can use the following command to disable the browser choice screen within MDT or SCCM infastructures.

REG ADD HKLM\Software\BrowserChoice /v Enable /t REG_DWORD /d 0 /f

Set the key to 1 if you want to enable the browser choice screen. Set the key to 0 if you want to disable it.

2013-10-28_10h35_42    2013-10-28_10h43_45    2013-10-28_10h44_47

2013-10-28_10h44_12    2013-10-28_10h43_52