The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

Archive for the ‘Deployment’ Category

PowerShell is King – Using PowerShell in a Task Sequence – Part 1

Posted by Mikael Nystrom on April 24, 2013

Traditionally VBscript has been “the” script type to use in OS Deployment scenarios, but with WinPE 4.0 in the ADK and MDT 2012 (u1) it is now an option in some scenarios.

Scenario:

You would like to use a PowerShell script that uses properties from the ZTIGather process

Solution:

Create the script and save it in the scripts folder in the deployment share (LTI) or in the MDT packages folder (ZTI) and then add it to the Task Sequence and if needed add any parameters you need to pass to the script. You don’t need to add any parameters from the LTI/ZTI environment, since they will be available within $TSenv:

image

The script:

Here is just a demo script that does not do anything at all, but it should give you an idea of how to create those scripts.


#Demo.ps1

#Setting
$ScriptFile = $MyInvocation.MyCommand.Name
$ScriptLocation  = Split-Path $MyInvocation.MyCommand.Path -Parent

#Setting Vars
$OSDComputername = $TSEnv:OSDCOMPUTERNAME
$Make = $TSEnv:Make
$Model = $TSEnv:Model

#Performing Action
Write-Progress -Activity "Checking Hardware…" -Status "Running Inventory" -PercentComplete 12 -Id 1
Start-Sleep -Seconds 3

Write-Progress -Activity "Checking Hardware…" -Status "Running $ScriptFile" -PercentComplete 12 -Id 1
Start-Sleep -Seconds 3

Write-Progress -Activity "Checking Hardware…" -Status "Running $ScriptLocation" -PercentComplete 12 -Id 1
Start-Sleep -Seconds 3

Write-Progress -Activity "Checking Hardware…" -Status "Make is now $Make" -PercentComplete 32 -Id 1
Start-Sleep -Seconds 3

Write-Progress -Activity "Checking Hardware…" -Status "Model is now $MODEL" -PercentComplete 85 -Id 1
Start-Sleep -Seconds 3

Write-Progress -Activity "Checking Hardware…" -Status "Waiting when we are at 99% just because we can…" -PercentComplete 99 -Id 1
Start-Sleep -Seconds 3

Write-Progress -Activity "Checking Hardware…" -Status "Done" -PercentComplete 100 -Id 1
Start-Sleep -Seconds 3


 

Explaining the script:

The first block is just to set variables for the script it self, it s possible to use other methods, but I prefer to use the built-in method in PowerShell to find out where I am instead of using the translated way in LTI/ZTI

The next block is to show you how to convert a variable from the Task Sequence using the $TSEnv: drive. You don’t need to do this, it is possible to use $TSEnv:OSDComputername directly, but I think this is a bit easier.

Remaining blocks will display the information on the screen while running.

Download Script

/mike

Posted in Deployment, MDT, PowerShell, SCCM | 1 Comment »

Deployment Roadshow 2013 in Sweden!

Posted by Mikael Nystrom on March 29, 2013

Inte första gången

och inte heller sista gången som vi gör detta, det är nämligen en av de få sakerna vi gör bara för att det är så grymt kul. Vi kommer att visa massor med olika saker kring OS Deployment och management. Du kan ta med dej kunskaperna hem och I praktiken använde det du har lärt dej direkt!. Mitt förslag är att du snabbt som attan anmäler dig här innan det är fullt. För du vill väl inte missa tillfället att ställa frågor och få svar, eller se praktiska runbooks, VDI demos, ConfigMgr 2012 SP1 prylar, nya snygga saker I AD:t, en portion PowerShell och annat smått och gott!

http://www.deploymentevents.se/

Var? När?
Göteborg 2013-04-22
Malmö 2013-04-23
Stockholm 2013-04-24
Umeå 2013-04-25

 

/mike

Posted in Deployment, Lite Touch, MDT, RoadShow, SCCM, System Center 2012, Windows 7, Windows 8, Windows Server 2012 | Tagged: , , , , , | Leave a Comment »

PowerShell is King – I need to monitor OS Deployment in MDT 2012 not using Deployment Workbench

Posted by Mikael Nystrom on March 6, 2013

Scenario:

You are using MDT 2012 Update 1 (Lite Touch or Zero Touch), you have enabled MDT monitoring and you would like to know the current status of the OSD deployment, but you would like to read directly from the OData feed using PowerShell and maybe get a nice grid-view. Now, you might wonder why and that is easy, basically every blog post I have seen on this topic assumes you are logged on to the server where the MDT Workbench exists, but that is not always the case.

Solution:

Use PowerShell to get the data using the Invoke-RESTMethod, convert and read it as a Grid view

Display on screen in text

image

Display using grid view:

image

PowerShell command to execute:

You need to change MDT01 to the name of your deployment server for this to work.


$URL = "http://MDT01:9801/MDTMonitorData/Computers"

function GetMDTData {
  $Data = Invoke-RestMethod $URL

  foreach($property in ($Data.content.properties) ) {
    New-Object PSObject -Property @{
      Name = $($property.Name);
      PercentComplete = $($property.PercentComplete.’#text’);
      Warnings = $($property.Warnings.’#text’);
      Errors = $($property.Errors.’#text’);
      DeploymentStatus = $(
        Switch ($property.DeploymentStatus.’#text’) {
        1 { "Active/Running" }
        2 { "Failed" }
        3 { "Successfully completed" }
        Default { "Unknown" }
        }
      );
      StartTime = $($property.StartTime.’#text’) -replace "T"," ";
      EndTime = $($property.EndTime.’#text’) -replace "T"," ";
    }
  }
}

GetMDTData | Select Name, DeploymentStatus, PercentComplete, Warnings, Errors, StartTime, EndTime | Out-GridView


Download script here:  http://sdrv.ms/WtxtnU

/mike

Posted in Deployment, MAP, PowerShell, SCCM | 6 Comments »

Back to Basic–CustomSettings.ini–Sample 2

Posted by Mikael Nystrom on March 6, 2013

Over the years I have done a few customsettings.ini file configurations. Some for LTI, some for ZTI. I have done a bunch of demos during class, sessions and for customers, but I realize I have never published them, and since my blog post Back to Basic – Custom Settings Explained is the most read post I have done (it has been on the top 10 list since it was published) I decided to publish the rest of them

Scenario:

You are about to deploy virtual machines using LiteTouch (Some parts will work in ZeroTouch)

Requirements:

  • Machines with a certain BIOS version need to install an application
  • Model names should be normalized
  • The computer name should be generated based on prefix and the MAC Address
  • The computer prefix should be based on the normalized model name
  • The OU location should be based on the normalized model name

Solution:

[Settings]
Priority=HardwareInfo, MakeAlias, ModelAlias,SMBIOSBiosVersion,Default, SetOSD
Properties=ModelAlias,MakeAlias,SMBIOSBiosVersion,MacAlias,OSDPrefix,MachineOULocation

[HardwareInfo]
UserExit=AliasUserExit.vbs
MakeAlias=#SetMakeAlias()#
ModelAlias=#SetModelAlias()#
SMBIOSBIOSVersion=#SetSMBIOSBIOSVersion()#
MacAlias=#SetMacAlias()#

[68SCFVerF28]
Applications001={50ccee5b-973d-44cc-9d66-fbe506d9852b}

[Default]
OSInstall=Y
OSDPrefix=PC
MachineOULocation=Unknown

[Hyper-V2008R2]
OSDPrefix=VM
MachineOULocation=VMs
DoNotCreateExtraPartition=YES

[HP EliteBook 8540w]
OSDPrefix=HP
MachineOULocation=LapTops

[HP EliteBook 8460p]
OSDPrefix=HP
MachineOULocation=LapTops

[SetOSD]
OSDComputername=%OSDPrefix%-%MacAlias%
MachineObjectOU=OU=%MachineOULocation%,OU=WorkStations,OU=ViaMonstra,DC=corp,DC=viamonstra,DC=com

BDD.log:

Added new custom property MODELALIAS
Added new custom property MAKEALIAS
Added new custom property SMBIOSBIOSVERSION
Added new custom property MACALIAS
Added new custom property OSDPREFIX
Added new custom property MACHINEOULOCATION
Using from [Settings]: Rule Priority = HARDWAREINFO, MAKEALIAS, MODELALIAS,SMBIO
SBIOSVERSION,DEFAULT, SETOSD
—— Processing the [HARDWAREINFO] section ——
UserExit: started: SECTION BEFORE HARDWAREINFO
User exit “\\HOST03\MDTLab$\Scripts\AliasUserExit.vbs” called successfully, skip
= False.
UserExit: Running function SetModelAlias
UserExit: Make is now Hewlett-Packard
UserExit: Model is now HP EliteBook 8460p
UserExit: Win32_ComputerSystemProduct Version: A0001D02
UserExit: Win32_BIOS Version: HPQOEM – f
UserExit: Alias rule not found.  ModelAlias set to Model value.
UserExit: ModelAlias has been set to HP EliteBook 8460p
UserExit: Departing…
Property MODELALIAS is now = HP EliteBook 8460p
Using from [HARDWAREINFO]: MODELALIAS = HP EliteBook 8460p
UserExit: Running function SetMakeAlias
UserExit: Make is now Hewlett-Packard
UserExit: Alias rule not found.  MakeAlias will be set to Make value.
UserExit: MakeAlias has been set to Hewlett-Packard
UserExit: Departing…
Property MAKEALIAS is now = Hewlett-Packard
Using from [HARDWAREINFO]: MAKEALIAS = Hewlett-Packard
UserExit: Running function SetSMBIOSBIOSVersion
UserExit: SMBIOSBIOSVersion has been set to 68SCFVerF28
UserExit: Departing…
Property SMBIOSBIOSVERSION is now = 68SCFVerF28
Using from [HARDWAREINFO]: SMBIOSBIOSVERSION = 68SCFVerF28
UserExit: Running function SetMacAlias
UserExit: MacAddress001 is now 00:15:5D:01:83:00
UserExit: SetMacAlias has been set to 00155D018300
UserExit: Departing…
Property MACALIAS is now = 00155D018300
Using from [HARDWAREINFO]: MACALIAS = 00155D018300
UserExit: started: SECTION AFTER HARDWAREINFO
User exit “\\HOST03\MDTLab$\Scripts\AliasUserExit.vbs” called successfully, skip
= False.
—— Processing the [Hewlett-Packard] section ——
—— Processing the [HP EliteBook 8460p] section ——
Property OSDPREFIX is now = HP
Using from [HP EliteBook 8460p]: OSDPREFIX = HP
Property MACHINEOULOCATION is now = LapTops
Using from [HP EliteBook 8460p]: MACHINEOULOCATION = LapTops
—— Processing the [68SCFVerF28] section ——
Property APPLICATIONS001 is now = {50ccee5b-973d-44cc-9d66-fbe506d9852b}
Added value from [68SCFVerF28]: APPLICATIONS = {50ccee5b-973d-44cc-9d66-fbe506d9
852b}
—— Processing the [DEFAULT] section ——
Property OSINSTALL is now = Y
Using from [DEFAULT]: OSINSTALL = Y
—— Processing the [SETOSD] section ——
Property OSDCOMPUTERNAME is now = HP-00155D018300
Using from [SETOSD]: OSDCOMPUTERNAME = HP-00155D018300
Property MACHINEOBJECTOU is now = OU=LapTops,OU=WorkStations,OU=ViaMonstra,DC=co
rp,DC=viamonstra,DC=com
Using from [SETOSD]: MACHINEOBJECTOU = OU=LapTops,OU=WorkStations,OU=ViaMonstra,
DC=corp,DC=viamonstra,DC=com
—— Done processing c:\csdemo\Samples\Settings based on UserExit-Alias.ini –
—-
Remapping variables.
Property TaskSequenceID is now =
Property DeploymentType is now =
Finished remapping variables.
ZTIGather processing completed successfully.

Remark:

In this case we use a user exit script to collect additional information from WMI and set is variables in MDT to be used later, one of the things is collection the BIOS version and normalize it and then we use that as a priority section that will add an application if that certain BIOS version shows up, we also remove all : in the mac address, so we can use it as part of the computer name, the other part comes from the model(model alias). To make this work you also need the user exit script and that is included in the download. Note:This is just an example of what you can do and how the customsettings.ini file works.

Download:

http://sdrv.ms/XTctly

 

/Mike

Posted in Deployment, MDT | 1 Comment »

Back to Basic–CustomSettings.ini–Sample 1

Posted by Mikael Nystrom on March 5, 2013

Over the years I have done a few customsettings.ini file configurations. Some for LTI, some for ZTI. I have done a bunch of demos during class, sessions and for customers, but I realize I have never published them, and since my blog post Back to Basic – Custom Settings Explained is the most read post I have done (it has been on the top 10 list since it was published) I decided to publish the rest of them

Scenario:

You are about to deploy virtual machines using LiteTouch

Requirements:

  • Only VM’s should be possible to deploy
  • No extra partition should be created
  • The computer name should be generated

Solution:

[Settings]
Priority=ByVMType, Default
Properties=MyCustomProperty

[Default]
OSInstall=NO

[ByVMType]
Subsection=IsVM-%ISVM%

[IsVM-True]
OSInstall=Y
DoNotCreateExtraPartition=YES
OSDComputername=VDI-#Left(“%SerialNumber%”,12)#

BDD.log:

Using from [Settings]: Rule Priority = BYVMTYPE, DEFAULT
—— Processing the [BYVMTYPE] section ——
—— Processing the [IsVM-True] section ——
Property OSINSTALL is now = Y
Using from [IsVM-True]: OSINSTALL = Y
Property OSDCOMPUTERNAME is now = VDI-8069-2911-20
Using from [IsVM-True]: OSDCOMPUTERNAME = VDI-8069-2911-2
Property DONOTCREATEEXTRAPARTITION is now = YES
Using from [IsVM-True]: DONOTCREATEEXTRAPARTITION = YES
—— Processing the [DEFAULT] section ——

Remark:

In this case we are using a section called ByVmType which will find a subsection called IsVM-True if we are running a VM which will set the OSinstall property to Y and then it will build the OSDComputername based on VDI plus the 12 most left characters in the serial number.

Download:

http://sdrv.ms/XTctly

 

/Mike

Posted in Deployment, MDT | 1 Comment »

PowerShell is King – I’m using MDT 2012 to deploy OS, did the deployment went well?

Posted by Mikael Nystrom on January 16, 2013

Scenario:

You are using MDT 2012 Update 1 (Lite Touch or Zero Touch), you have enabled MDT monitoring and you would like to know if the deployment of the machine was ok.

Solution:

Use PowerShell to read from the event log, since the MDT Monitor feature will write in the event log

Display on screen in text

Get-EventLog -ComputerName MDT01 -LogName Application -Source MDT_Monitor | select TimeGenerated, EntryType, InstanceID, Message | Format-Table

image

Display using the gridview

Get-EventLog -ComputerName MDT01 -LogName Application -Source MDT_Monitor | Out-GridView

image

Display using HTML

Get-EventLog -ComputerName MDT01 -LogName Application -Source MDT_Monitor | select TimeGenerated, EntryType, InstanceID, Message | ConvertTo-Html -title "OS Deployment status: $ENV:COMPUTERNAME" -body (get-date) -pre "<H1>OS Deploymentstatus for: $ENV:COMPUTERNAME </H1><P>Generated by Corporate IT</P>" -post "<P>For details, contact Corporate IT.</P>" > $ENV:TEMP\MDTstatus.htm; Invoke-Item $ENV:TEMP\MDTstatus.htm

image

/mike

Posted in Deployment, MDT, PowerShell | 4 Comments »

Hydration Kit V3 is out

Posted by Mikael Nystrom on January 4, 2013

HYDV3This hydration kit is basically what we use internally to build labs, POC,s and demo environment. It does require Hyper-v on Windows 8 or Windows Server 2012. With this kit you can deploy ready made VMs in a very short time. The kit handles to deploy

Windows Server

Windows Server 2008 R2 and Windows Server 2012 in various readymade configurations like, Domain Controller, Fileservers, Print Server, Management Server, Remote Desktop Servers and some more

Windows Client

Windows 7 and Windows 8 with or without Office 2012 or Office 2013

System Center 2012 SP1

System Center 2012 SP1, Configuration Manager, Data Protection Manager, Virtual Machine Manager, Operations Manager, App Controller and Service Manager (In the SM case, you can chose between Windows Server 2012 or Windows Server 2008 R2, in the later it will also install SharePoint and the Self Service portal

SQL Server 2012

Windows Server 2012 with SQL Server 2012 installed

If you need support and help my best bet is the FB group we have http://www.facebook.com/groups/318384504933665/

the kit can be downloaded from http://sdrv.ms/YJNHJn

/mike

Posted in Deployment, Geek Week, Hyper-V, MDT, SCCM, SCM, SCVMM, System Center 2012, TechEd, Windows 7, Windows 8, Windows Server 2008 R2, Windows Server 2012 | Tagged: | 4 Comments »

Nice to Know: Remove the Windows 8 Animation during OS Deployment

Posted by Mikael Nystrom on January 2, 2013

Don’t get me wrong, I like to watch a god movie, it’s just that I don’t like to see the same movie twice. In Windows 8 there is a movie that is played for the first time logon and there is a Group Policy setting you can use to disable it. However, since I’m an OSD guy, I prefer to remove it long before that. So here you have a nice MDT Application you can download and install and put it into your task sequence for Windows 8 and you will never ever see it once more. Happy deployment!

(and thank you Jeremy Moskowitz for the idea on YouTube)

Download the zip file, extract it and create a new Application in MDT 2012 Update 1.

Select Application with Source Files

image

Give it a name

image

Select the location of your download

image

Give it a name

image

Type in the command

cscript Configure-Win8AnimAtFirst.wsf

image

Finish

image

Then you add it to your task sequence. Done

image

The script looks like this:


<job id="Configure-Win8AnimAtFirst">
<script language="VBScript" src="..\..\Scripts\ZTIUtility.vbs"/>
<script language="VBScript">

‘//—————————————————————————-
‘// Solution: Hydration
‘// Purpose: Used to turn off the animation in Windows at first logon
‘// Usage: cscript Configure-Win8AnimAtFirst.wsf [/debug:true]
‘// Version: 1.0 – Jan 02 2013 – Mikael Nystrom
‘//
‘// This script is provided "AS IS" with no warranties, confers no rights and
‘// is not supported by the authors or the Deployment Bunny.
‘//
‘//—————————————————————————-

‘//—————————————————————————-
‘// Global constant and variable declarations
‘//—————————————————————————-

Option Explicit

Dim iRetVal

‘//—————————————————————————-
‘// End declarations
‘//—————————————————————————-

‘//—————————————————————————-
‘// Main routine
‘//—————————————————————————-

On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0

‘//—————————————————————————
‘//
‘// Function: ZTIProcess()
‘//
‘// Input: None
‘//
‘// Return: Success – 0
‘// Failure – non-zero
‘//
‘// Purpose: Perform main ZTI processing
‘//
‘//—————————————————————————
Function ZTIProcess()

    oLogging.CreateEntry "Configure Animation in Windows 8: Starting", LogTypeInfo   

    oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableFirstLogonAnimation", "0", "REG_DWORD"

    oLogging.CreateEntry "Configure Animation in Windows 8: Done", LogTypeInfo   

End Function

</script>
</job>


 

/mike

Posted in Deployment, SCCM, System Center 2012, Windows 8 | Tagged: | 3 Comments »

Using Runbooks as part of a Task Sequence–Part 1

Posted by Mikael Nystrom on November 28, 2012

This is the first post in series of post that will focus on the integration between MDT 2012 Update 1 and System Center 2012 Orchestrator.

The Scenario:

The company ViaMonstra is about to migrate to a new operating system. They will use the refresh scenario, but they would like to avoid doing backup of all computers. Luckily all VIP computers are a member of a global domain group. So what we need is a easy way to check the group membership of the computer. If the computer is a member of the VIP group we will do backup, otherwise we will not.

The Solution:

Create a runbook in Orchestrator that checks membership of the VIP group, add the runbook execution in the correct location in the task sequence, deploy and be happy.

The how to:

The Orchestrator Runbook

This is how the runbook needs to look.

image

The runbook works like this:

We feed the runbook with the name of the computer and the name of the group we would like to check membership of

image

Find the group in Active Directory

image

Check if the computer is a member of that group
(Note: We use the OSDComputername but to check the membership we need to add $ in the end of the variable, since that is the correct name of the computer when we search for the SM account name)

image

If the computer is a member we will return ComputerBackupLocation set to AUTO

image

image

If the computer is not a member of the group we will return ComputerBackupLocation set to NONE

image

image

To configure the return property correct you need to configure return value by adding whatever you would like to return using properties on the runbook it self.

image

The Task Sequence:

In the Task Sequence we will add runbook just before we fire up the backup, like this.

image

As you can see, the runbook will show us the runbook parameters it accept as input and in this case we are smart and use the same property name that are used in the Task Sequence, that is OSDComputerName. but it also need the Property VIPComputerGroup and that property needs to be added to customsettings.ini, like this

image

When running a test task sequence that only contains the runbook and some set parameters you can verify that the runbook works correct and return the correct property. Here is a picture of the bdd.log file where you can see that the when we send in the computername and VIPComputerGroup and we will get ComputerBackupLocation property as AUTO

image

It is pretty smart to create a test sequence that only contains the runbook plus property values you need to verify that it works, to do that just create a custom task sequence that looks like this and then run the sequence using LiteTouch.vbs and check the bdd.log file. Here is how the test task sequence looks like.

image

You can download the runbook, the test task sequence and customsettings ini here

/mike

Posted in Deployment, MDT, System Center 2012 | Leave a Comment »

Where to find all WinPE drivers for almost all HP Servers in one location?

Posted by Mikael Nystrom on October 24, 2012

As a part of my daily life I build deployment solutions for customers that supports both Server OS and for Client OS and one of the components need are drivers for WinPE. Normally not a problem on the client side, but for servers there are some things that could let you grow a bit more gray hair then needed.

32bit drivers for 64bit OS

Since I prefer to have only one single boot image I would like to have the 32 bit version since that handles both 32 and 64 bit OS images. There is no obvious way to find the 32 bit versions of the driver in the 64 bit edition of Windows Server webpage. When deploying using System Center 2012 Virtual Machine Manager you need the 64 bit drivers and you might want to use the HP Insight Control for System Center instead

Specialized WinPE drivers might be needed

Even if WinPE is a subset of Windows it should be able to use the normal drivers, but “should” is just a word. In many cases the dual bus architecture or other “inventions” might require monolithic drivers. Those drivers should not be used in the running OS, only in WinPE

The solution (if you have a HP Server)

HP have something called Scripting Toolkit and that just happens to contain all the drivers needed for storage and network for all ML/DL/BL HP ProLiant DL/ML/SL 300, 500, 700, 900 and HP ProLiant BL server series and HP ProLiant 100 G6 series and higher which basically covers “all” server from HP. The current version is 8.70 for x86 and can be downloaded and the x64bit version here

When you extract the archive into a folder it will look like this

image
Guess where the drivers are…

Getting the drivers in the correct location

For MDT 2012 Update 1

This is pretty straight forward. Open deployment workbench and add the drivers to the WinPEx86 folder (if you do not have one, you should create that)

image

Modify so that all drivers from that folder is imported into the boot image

image

For Windows Deployment Services for Windows Server 2012

Not that hard either, remember we only need these drivers for WinPE, not for the running OS so when we import them we need to flag them so that will never be installed, we just need to have them imported so that we can apply them to the WinPE image, it should look like this

image

For WinPE from ADK

The offline method:

Dism /Mount-WIM /WimFile:c:\winpe\winpe.wim /index:1 /MountDir:c:\winpe\mount\
Dism /image:c:\winpe\mount /Add-Driver /Driver:e:\drivers /Recurse
Dism /unmount-wim /Mountdir:c:\winpe\mount /commit

The online method:

drvload.exe <path>

For System Center 2012 Virtual Machine Manager:

Note: For System Center 2012 Virtual Machine Manager you can also download the HP Insight Control for System Center, that contains HP server drivers for network and storage, however, those are only 64 bit drivers. So for the SCVMM solution you can either download the scripting toolkit driver pack, but for SCVMM they need to be x64 bit drivers or you can download the HP Insight Control for System Center kit that is only x64 bit version. It will basically be the same driver, the HP Insight Control for System Center has one part that is rather nice, it has an installer that will install all the drivers and then tag them during the import so that you can use tags when injecting them into WinPE

If the drivers are imported into the SCVMM library and tagged method:

Use the following PowerShell command:

Import-Module "C:\Program Files\Microsoft System Center 2012\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager.psd1"
Get-SCVMMServer localhost
$mountdir = "e:\mount"
$winpeimage = "e:\temp\boot.wim"
$winpeimagetemp = $winpeimage + ".tmp"
mkdir "e:\mount"
copy $winpeimage $winpeimagetemp
dism /mount-wim /wimfile:$winpeimagetemp /index:1 /mountdir:$mountdir
$drivers = get-scdriverpackage | where { $_.tags -match "WINPE" }
foreach ($driver in $drivers)
{
$path = $driver.sharepath
dism /image:$mountdir /add-driver /driver:$path
}
Dism /Unmount-Wim /MountDir:$mountdir /Commit
publish-scwindowspe -path $winpeimagetemp
del $winpeimagetemp

If the drivers are in folder and NOT imported into the SCVMM library:

Use the following PowerShell command:

Import-Module "C:\Program Files\Microsoft System Center 2012\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager.psd1"
Get-SCVMMServer localhost
$mountdir = "e:\mount"
$winpeimage = "e:\temp\boot.wim"
$winpeimagetemp = $winpeimage + ".tmp"
mkdir "e:\mount"
copy $winpeimage $winpeimagetemp
dism /mount-wim /wimfile:$winpeimagetemp /index:1 /mountdir:$mountdir
$path = "e:\temp\drivers"
dism /image:$mountdir /add-driver /driver:$path /recourse
Dism /Unmount-Wim /MountDir:$mountdir /Commit
publish-scwindowspe -path $winpeimagetemp
del $winpeimagetemp

/mike

Posted in Deployment, MDT, SCVMM, System Center 2012, Virtual Machine Manager | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 1,540 other followers