The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • about.me

    about.me/mikaelnystrom

  • Archives

  • Meta

OSD – Add information to the Computer during OSD using a Custom Tattoo Step

Posted by Mikael Nystrom on December 2, 2016

When using an MDT (integrated in ConfigMgr or standalone) there is a step called Tattoo, this step will write information to the registry as well as to the WMI repository.

Let us see what it looks by default:

Get-WMIObject –Class Microsoft_BDD_Info

image
Result.

Get-Item -Path ‘HKLM:\SOFTWARE\Microsoft\Deployment 4’

image

Cool, but I need my own stuff?

We have done this for various  reasons and many customers, it could be used for making sure the computer ends up in certain ConfigMgr Collections, or that applications behave in a certain way, or that the asset management tools does the job differently, or that the correct support team can know what the computer was configured for, or what task sequence that was used, or…. As you see the are some valid reasons for this, no doubt.

The question is of course, should you modify the existing ZTITatto.wsf and corresponding .MOF file?, No, you should not do that, instead you should create new files and use them instead.

So, here is the download : https://github.com/DeploymentBunny/Files/tree/master/Tools/Custom-ZTITatoo

To make the work in a task sequence you need to add the files to you Scripts folder, update the CustomSettings.ini if you are using Custom Properties and add a step in the Task Sequence.

Here is a sample of CustomSettings.ini

image

I have added 4 new properties, added them to a MacAddress, so first step is to verify that the ZTIGather process reads this correct, let us verify this by running:

cscript \\redepl01\mdtproduction$\Scripts\ZTIGather.wsf /inifile:c:\Temp\CustomSettings.ini

image
Result after running the following command to perform the inventory.

Now, lets run the custom tattoo script:

cscript \\redepl01\mdtproduction$\Scripts\ViaMonstraTatoo.wsf

image
That looks great!

Now, let us verify that we get the correct data from WMI and Registry:

First, get the WMI repository:

Get-WmiObject -Class ViaMonstra_Info

image
The WMI repository was updated.

Let us check the Registry:

Get-Item -Path ‘HKLM:\SOFTWARE\ViaMonstra\OSD’

image
The Registry was updated.

At LabCenter

The Customer LabCenter deploys computer for hands-on labs and they wanted each computer to be tattooed with information regarding the LAB and one thing they use it for is to be able to display the information directly in the screen using BGinfo, but they also use it for other purposes. BGInfo reads the Registry values, or WMI

image

How to change my own stuff then?

Download the files from:https://github.com/DeploymentBunny/Files/tree/master/Tools/Custom-ZTITatoo and edit the scripts, (.wsf and .mof) by replacing the values that are in use, like

  • ViaMonstra
  • ViaRole
  • ViaClass
  • ViaOwner
  • ViaTag

Save, and verify

/mike

Posted in ConfigMgr, Lite Touch, MDT, OSD, Zero Touch | Tagged: , , , , | 2 Comments »

Nice to Know – The Deployment Bunny is now on GitHub

Posted by Mikael Nystrom on November 25, 2016

I have been on GitHub for a while, but lately I have started to move everything I do to GitHub, for various reasons. One is that is easier for you to get the files directly, another is that I get source control. But there are many more reasons for this. There are many different repositories, the two main repositories are Functions and The Bunny Files and when I do demo script they will usually end up in the Demo Script folder.

image
The Bunny at GitHub.

Can I “Steal” your script?

Yes, you can, but it would be nice to get cred for the work, so include the link to the blog or to the GitHub repository. However, I don’t like to see my scripts ending up in PowerShell Gallery or the TechNet Gallery without asking me first…

How can I use the scripts directly from my scripts?

That is easy, you do something like this:

Invoke-WebRequest "https://raw.githubusercontent.com/DeploymentBunny/Files/master/Tools/Enable-NestedHyperV/EnableNestedHyperV.ps1" -OutFile ~/EnableNestedHyperV.ps1
Import-Module ~/EnableNestedHyperV.ps1
Enable-NestedHyperV -VMname TEST100

How will this affect the future?

This basically means that everything I do will end up at GitHub first and later most of this will then have a related blogpost, but not all, and not the same day.

/mike

Posted in GitHub, PowerShell | Tagged: , | 5 Comments »

Working in the Datacenter – I need to know everything about my VHD’s in my SCVMM environment

Posted by Mikael Nystrom on November 25, 2016

I was asked about getting more information about all the VHDs in a SCVMM environment (you now how you are). It is actually easy to do this, so i created a function that uses the SCVMM PowerShell module to grab all data and does a calculation on the expansion rate in percent for all disks, it pretty much gives you this:

image
Result.

The result will be that you now know where they are, sizes, expansion, type, parents, and some more info as well, and if you know, you can act.

You can grab the module from GitHub: https://github.com/DeploymentBunny/Files/tree/master/Tools/Get-VIASCVMMDiskInfo

/mike

Posted in PowerShell, System Center 2012 R2, System Center 2016, System Center Virtual Machine Manager | Tagged: , , , | Leave a Comment »

Nice to Know – Add support for Windows Server 2016 in System Center Virtual Machine Manager 2012 R2

Posted by Mikael Nystrom on November 15, 2016

Recently Microsoft released a hotfix for SCVMM 2012 R2, after installed you will have support for Windows Server 2016 as a guest OS. The name of the hotfix is “KB3199246 – Hotfix 1 for Update Rollup 11 of System Center 2012 R2 Virtual Machine Manager” which not really explains that. You can read more and download it here:

image

/mike

Posted in System Center 2016, System Center Virtual Machine Manager | Tagged: , | Leave a Comment »

Working in the Datacenter – Upgrade System Center 2016 Orchestrator Integration Pack

Posted by Mikael Nystrom on November 14, 2016

Here is the list of System Center 2016 Integration Pack that is provided by Microsoft, if you have upgraded to to the latest version, should also upgrade to the latest version of the IOP’s.

image

The top download contains the following OIPs:

  • System Center 2016 Integration Pack for System Center 2016 Configuration Manager
  • System Center 2016 Integration Pack for System Center 2016 Data Protection Manager
  • System Center 2016 Integration Pack for System Center 2016 Operations Manager
  • System Center 2016 Integration Pack for System Center 2016 Service Manager
  • System Center 2016 Integration Pack for System Center 2016 Virtual Machine Manager
  • System Center 2016 Integration Pack for REST
  • System Center 2016 Integration Pack for Exchange User
  • System Center 2016 Integration Pack for Exchange Admin
  • System Center 2016 Integration Pack for File Transfer Protocol (FTP)
  • System Center 2016 Integration Pack for Active Directory
  • System Center 2016 Integration Pack for Windows Azure
  • System Center 2016 Integration Pack for Microsoft SharePoint 2013

One minor thing to note, the System Center 2016 Integration Pack for System Center 2016 Operations Manager does no longer require an install of the OpsMgr Console on the Orchestrator.

/mike

Posted in System Center 2016 | Tagged: | Leave a Comment »

OSD – Microsoft Deployment Toolkit Build 8443 is out

Posted by Mikael Nystrom on November 14, 2016

Today a new version of MDT was released, the main reason is Quality Updates and full support for Windows Server 2016 as well as Windows 10 1607. It does require ADK 1607. If you are using MDT in your OS deployment solution, go ahead, download, read, update and enjoy live.

image

/mike

Posted in MDT, OSD | Tagged: , | 2 Comments »

Nice to Know – The hidden location for all HP servers drivers

Posted by Mikael Nystrom on November 9, 2016

The latest version of HP support pack was released recently, 2016.10.0 and we downloaded it to deploy it as usual, but Jorgen Brandelius at TrueSec could not resist the need of poking around on the media, and there is was, the hidden folder!!!

image
the magic folder.

What’s in the folder?

In the folder you will find the following structure, it is basically all drivers for Windows Server 2016 (and older supported OS as well) for all supported HP servers, it also includes agents for NANO server running on HP ProLiant.

image

What now?

Download, import and smile while you are deploying the HP server.

image

/mike

Posted in Deployment, Drivers, HP | Tagged: , , , , | 6 Comments »

PowerShell is King – Find VM Configuration files (.vmcx) that have not been imported/registered

Posted by Mikael Nystrom on November 9, 2016

Sometime you need to move a large number of VMs, or you need to recover from a broken hyper-v host, or similar. If you have a few VM’s, that will be easy, but if you have many you will most likely use PowerShell to import the VM’s. That works perfectly fine, but you have a few VM’s that did weren’t imported correctly you will end in a state when you ask your self –Which VM’s are imported and which ones are not?

(You can download the script from GitHub: https://github.com/DeploymentBunny/Files/tree/master/Tools/Get-VIAUnimportedvmcxFiles )

Find the not yet imported VM configurations

That will of course be done using PowerShell, and here is the function that I use

image
Script and output.

Function Get-VIAUnimportedvmcxFiles
{
    <#
    .Synopsis
        Script used find not yet imported Hyper-V Configurations
    .DESCRIPTION
        Created: 2016-11-07
        Version: 1.0
        Author : Mikael Nystrom
        Twitter: @mikael_nystrom
        Blog   : http://deploymentbunny.com
        Disclaimer: This script is provided "AS IS" with no warranties.
    .EXAMPLE
        Get-VIAUnimportedvmcxFiles
    #>    
    [CmdletBinding(SupportsShouldProcess=$true)]
    
    Param(
    [string]$Folder
    )

    if((Test-Path -Path $Folder) -ne $true){
        Write-Warning "I'm sorry, that folder does not exist"
        Break
    }

    $VMsIDs = (Get-VM).VMId
    $VMConfigs = (Get-ChildItem -Path $Folder -Filter *.vmcx -Recurse).BaseName

    $obj = Compare-Object -ReferenceObject $VMsIDs -DifferenceObject $VMConfigs

    $Configs = foreach($Item in ($obj.InputObject)){
        $Items = Get-ChildItem -Path $Folder -Recurse -File -Filter *.vmcx  | Where-Object -Property Basename -Like -Value "*$Item" 
        $Items | Where-Object -Property FullName -NotLike -Value "*Snapshots*"
        }
    Return $Configs.FullName
}

/mike

Posted in Hyper-V, PowerShell | Tagged: , | Leave a Comment »

PowerShell is King – Find VHDs that are not connected to a VM

Posted by Mikael Nystrom on November 8, 2016

Working with VM’s in Hyper-V means that you will eventually have VHD’s that are not connected, not not even in use. That happens when you remove the VM configuration from Hyper-V manager, but you told your self “I will remove the data files later”, later very rarely happens, at least not for my lab and my demo environment (in production we use SCVMM and this issues is much less). In many cases this consumes space and I can use that space for other purposes.

(The script is available at GitHub: https://github.com/DeploymentBunny/Files/tree/master/Tools/Get-VIADisconnectedVHDs)

Get-VM, Get-ChildItems and Compare-Object solves the problem

Here is a function that will return an array of files from a folder you specify that is not directly connected to a VM.

image
In this case one disk is returned and this disk is not in use.

Function Get-VIADisconnectedVHDs
{
    <#
    .Synopsis
        Script used find .VHD files that are not connected to VM's
    .DESCRIPTION
        Created: 2016-11-07
        Version: 1.0
        Author : Mikael Nystrom
        Twitter: @mikael_nystrom
        Blog   : http://deploymentbunny.com
        Disclaimer: This script is provided "AS IS" with no warranties.
    .EXAMPLE
        Get-Get-VIADisconnectedVHDs
    #>    
    [CmdletBinding(SupportsShouldProcess=$true)]
    
    Param(
    [string]$Folder
    )

    if((Test-Path -Path $Folder) -ne $true){
        Write-Warning "I'm sorry, that folder does not exist"
        Break
    }

    #Get the disk used by a VM
    $VMs = (Get-VM | Where-Object -Property ParentSnapshotName -EQ -Value $null).VMId

    if(($VMs.count) -eq '0'){
        Write-Information "Sorry, could not find any VM's"
        Break
    }
    $VHDsActive = foreach($VMsID in $VMs){
        Get-VMHardDiskDrive -VM (Get-VM -Id $VMsID)
    }

    #Get the disk in the folder
    $VHDsAll = Get-ChildItem -Path $Folder -Filter *.vhd* -Recurse
    if(($VHDsAll.count) -eq '0'){
        Write-Information "Sorry, could not find any VHD's in $folder"
        Break
    }

    $obj = Compare-Object -ReferenceObject $VHDsActive.Path -DifferenceObject $VHDsAll.FullName

    #Compare and give back the list of .vhd's that are not connected
    Return ($obj | Where-Object -Property SideIndicator -EQ -Value =>).InputObject
}

/Mike

Posted in Hyper-V, PowerShell | Tagged: , | Leave a Comment »

PowerShell is King – Find out what Differencing disks that are in use

Posted by Mikael Nystrom on November 7, 2016

I use Hyper-V, in both production as well as for lab. One very effective way to spin up systems very fast is to use differencing disks, it also saves space. So I use differencing disks basically. After a while you tend to have some VM’s in your environment, and when it comes to a lab environment, well lets put it this way, I have disks all over the place.

(The function is on GitHub: https://github.com/DeploymentBunny/Files/tree/master/Tools/Get-VIAActiveDiffDisk)

I need to know what Parent hard drives that are active and in use

So, PowerShell to the rescue. First we get all hard disks that are connected to any of my VM’s, then we grab each disk that has a parent disk, an then we present that. That should give me a list of what parent disks are actually used.

   
Function Get-VIAActiveDiffDisk{
    <#
    .Synopsis
        Script used to Deploy and Configure Fabric
    .DESCRIPTION
        Created: 2016-11-07
        Version: 1.0
        Author : Mikael Nystrom
        Twitter: @mikael_nystrom
        Blog   : http://deploymentbunny.com
        Disclaimer: This script is provided "AS IS" with no warranties.
    .EXAMPLE
        Get-VIAActiveDiffDisk
    #>    
    [CmdletBinding(SupportsShouldProcess=$true)]
    param(
    )

    $VMHardDiskDrives = Get-VMHardDiskDrive -VM (Get-VM)
    $ActiveDisks = foreach($VMHardDiskDrive in $VMHardDiskDrives){
        $Diffs = Get-VHD -Path $VMHardDiskDrive.Path | Where-Object -Property VhdType -EQ -Value Differencing
        $Diffs.ParentPath
    }
    $ActiveDisks | Sort-Object | Select-Object -Unique
}

On my laptop that gives the the following return:

image
The output.

Posted in Hyper-V, PowerShell | Tagged: , | Leave a Comment »