Showing posts with label Computername. Show all posts
Showing posts with label Computername. Show all posts

Thursday, March 27, 2014

Most popular scripts, tools and queries for ConfigMgr usage

During ConfigMgr installation I'm using a lot of scripts, tools and queries. These are most used during or after OS deployment to get the job done. In this blogpost I mention a few of most popular scripts, tools and queries used. Have fun using them!
 
Adding Computer to AD groups during deployment
Application E-Mail Approval Tool
Automate Computer Name during OSD
ConfigMgr Console Extensions
Enabling and Disabling Microsoft Update in Windows 7
Group Policy WMI filters
Move computer object to another OU
Powershell Right Click Tools
Powershell script collection for ConfigMgr 2012
Remove from collection and clear PXE flag
Re-run Task Sequence Tool 1.0
RIGHT CLICK TOOLS FOR SCCM 2012 CONSOLE
SCCM 2012 Management Scripts
SCCM Client Actions Tool PowerShell Edition
Showing the Collection Membership of a Resource
System Center 2012 R2 Configuration Manager Toolkit

Update1:
Deploy Wifi profiles with SCCM
Endpoint Protection Definition Script
Remove Client from Collection after OSD 1.1
Show Collection Details right-click action
Show Maintenance Windows information for a device
 
Update 2:
Dell Command | Integration Suite for System Center
HP Client Integration Kit for ConfigMgr 2012 R2
Now Micro Right Click Tools (free)
Remove Expired & Superseded Updates in SUGs
Set of Operational SCCM Collections

Update 3:
Add computer to security group during OSD
System Center Endpoint Protection Policy Templates
ConfigMgr Prerequisites Tool 1.4.1

Even more scripts, tools and queries can be found here: "System Center - resources for IT professionals".

Monday, July 22, 2013

OS deployment in ConfigMgr fails with Error 80220005

Description: You see the following error messages on smsts.log:
Failed to open the Task Sequencing Environment. Code 0x80220005. Please ensure you are running this executable inside a properly configured OS Deployment task sequence.  

-Unknown error (Error: 80220005; Source: Unknown)
-Exiting with return code 0x80220005
-Process completed with exit code 2149711877
-Failed to run the action: Apply Windows Settings.
-Unknown error (Error: 80220005; Source: Unknown)

Solution: Make sure the computername is not too long. If the length is longer than 15 characters, shorten it.

After that OS deployment will be running fine again! :)

Friday, October 21, 2011

How to assign a computername before OS deployment

During OS deployment in ConfigMgr there are many ways to assign a computername. This can be done automatically or filled in before deployment. How to assign a dynamic computername is described here: How to assign a dynamic computername during OSD. In that post I'm using a script to create a dynamic computername from default BIOS values (assettag, serialnumber).

But what to do when you're using your own format which is not known in BIOS values? Then other ways are available. First there are ConfigMgr/MDT Task Sequence Variables. An overview of these Task Sequence Variables can be found here: http://technet.microsoft.com/en-us/library/bb632442.aspx

There are also many scripts to find for dynamic computername assignment. More about that on the following TechNet post: "SCCM R2 Unknown Computer Support and changing computer name during Task Sequence" http://social.technet.microsoft.com/Forums/en-US/configmgrosd/thread/5924e840-eb6e-48c1-858f-766a5be625a6/

The one I've used before is the ConfigMgr/MDT method, which asks the computername before deployment (manually) and uses this name during OS deployment. I will describe the steps needed for that here. First created a Non-mandatory advertisement on a OSD collection (in my case created as "Operating System Deployment"). On that specific OSD collection rightclick and choose "Modify Collection Settings".

Under "Collection Variables" tab create a new Variable called "OSDComputerName" and make sure it has no Value. Untick the "Do not display this value in the ConfigMgr console" also.

When choose OK the value will be available beneath "Collection Variables". Now choose OK to finish this configuration setting. Start the computer placed in this collection now and make sure it's non-mandatory. Use F12 for PXE boot indeed.

Once the task sequence is selected it prompts you to input the missing Task Sequence Variable. Watch out not to press Next here, but double click on "OSDComputerName" instead.

Fill in the computername of your choice (in my case HHO-01) and press OK. That way the computername will be saved and used during Operating System Deployment.

When the value is seen in the Task Sequence Wizard press Next. The Task Sequence selected will be running fine then because the missing Task Sequence Variable is known now.

That's all to assign a computername before OS deployment. Again ConfigMgr uses multiple ways to make OS deployment flexible and usable. This great product continues to astonish me with many great opportunities out there.

Tuesday, March 22, 2011

How to assign a dynamic computername during OSD

With ConfigMgr 2007 there can be put many information in the Task Sequence used for OSD. With Windows XP, Vista or 7 there will be different files created for using a unattend installation. All information set in the Task Sequence will be used for creating that specific file. Only a dynamically computername is missing here! How to assign a dynamic computername during OSD, that's the question!

In a Task Sequence used for OSD, this information can be placed in "Apply Windows Settings" and "Apply Network Settings". In "Apply Windows Settings" the following information is (most of times) set:
  • User/Organization name
  • Product key
  • Local administrator password
  • Time zone
In "Apply Network Settings" the following information is (most of times) set:
  • Join a workgroup or domain
  • Set specific domain information
  • Account used for domain join
With this information a sysprep.inf file (for Windows XP) or a unattend.xml file (for Windows Vista or 7) is created at specific places. The sysprep.inf file will be created/placed at C:\Sysprep (with the deployment tools). The unattend.xml will be created/placed at C:\Windows\Panther\Unattend. Sysprep is already build-in for Windows Vista and 7.

During above steps ("Apply Windows Settings" and "Apply Network Settings") these files will be generated. During "Setup windows and ConfigMgr" these files will be used for having a unattend installation. The only information missing here is how to set the computername?


With MDT integration an additional step is used for making that possible. Then a Task Sequence variable can be used for dynamically assigning a computername. This is explained here: http://blog.coretech.dk/mip/wrong-pc-name-after-deployment/

With ConfigMgr only (without MDT integration) an additional script is needed for unattended installation, or the computername must be filled-in manually during OSD (not recommended). The additional script must have lines in it for recognizing the computername in the BIOS, and place that information in the sysprep.inf or unattend.xml file.


Most of times I disable both "Apply Windows Settings" and "Apply Network Settings" steps in the Task Sequence, and making use of the sysprep.inf and/or unattend.xml which is created by ConfigMgr during OSD. The only change I make then is to replace the Computername with an "*" sign, and create a separate package from this file.

Then I put that file (as package) at the "Apply Operating System" step. The package which contains the script (converted to executable) is put in an additional step, in this case: "Assettag To Unattend". The script I use is as follows (using the Asset Tag as computername):

Windows XP on HP devices:
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Array.au3>
RunWait("cmd.exe /c " & "wmic /node:localhost systemenclosure get smbiosassettag > c:\sysprep\assettag.txt", "",@SW_HIDE)
$file = FileOpen("C:\sysprep\assettag.txt", 0)
$assettag = FileReadLine($file,2)
FileClose($file)
ReplaceInFile('C:\sysprep\sysprep.inf', "*", $assettag)
Func ReplaceInFile($io_file, $io_word, $io_replacement)
    Dim $Records
    $Lines = _FileCountLines($io_File)
    If Not _FileReadToArray($io_file, $Records) Then
        ConsoleWriteError("There was an error reading > " & $io_file & @CRLF)
        Exit
    ElseIf _FileReadToArray($io_file, $Records) == "" Then
        ConsoleWriteError("File is empty!" & @CRLF)
    ElseIf Not @error Then
        ConsoleWrite("> File succeeded!" & @CRLF)
    EndIf
    $File = FileOpen($io_file, 2)
    For $ax = 1 To $Records[0]
        ConsoleWrite("+> " & $Records[$ax] & @CRLF)
        $Replace = StringReplace($Records[$ax], $io_word, $io_replacement)
        ConsoleWrite("+> " & $Replace & @CRLF)
        If _FileCountLines($io_file) < UBound($Lines) - 1 Then
            FileWrite($File, $Replace & @CRLF)
        Else
            FileWrite($File, $Replace & @CRLF)
        EndIf
    Next
    FileClose($File)
EndFunc


Windows XP on Dell devices:
Replace "systemenclosure get smbiosassettag" with
"systemenclosure get serialnumber". Then it works also on Dell devices.


Windows Vista or 7 on HP devices:
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Array.au3>
RunWait("cmd.exe /c " & "wmic /node:localhost systemenclosure get smbiosassettag > c:\_SMSTaskSequence\assettag.txt", "",@SW_HIDE)
$file = FileOpen("C:\_SMSTaskSequence\assettag.txt", 0)
$assettag = FileReadLine($file,2)
FileClose($file)
ReplaceInFile('C:\Windows\Panther\unattend\unattend.xml', "*", StringStripWS ($assettag,8))
Func ReplaceInFile($io_file, $io_word, $io_replacement)
    Dim $Records
    $Lines = _FileCountLines($io_File)
    If Not _FileReadToArray($io_file, $Records) Then
        ConsoleWriteError("There was an error reading > " & $io_file & @CRLF)
        Exit
    ElseIf _FileReadToArray($io_file, $Records) == "" Then
        ConsoleWriteError("File is empty!" & @CRLF)
    ElseIf Not @error Then
        ConsoleWrite("> File succeeded!" & @CRLF)
    EndIf
    $File = FileOpen($io_file, 2)
    For $ax = 1 To $Records[0]
        ConsoleWrite("+> " & $Records[$ax] & @CRLF)
        $Replace = StringReplace($Records[$ax], $io_word, $io_replacement)
        ConsoleWrite("+> " & $Replace & @CRLF)
        If _FileCountLines($io_file) < UBound($Lines) - 1 Then
            FileWrite($File, $Replace & @CRLF)
        Else
            FileWrite($File, $Replace & @CRLF)
        EndIf
    Next
    FileClose($File)
EndFunc


Windows Vista or 7 on Dell devices:
Replace "systemenclosure get smbiosassettag" with
"systemenclosure get serialnumber". Then it works also on Dell devices.


(thanks to Wilfred Hanekamp for sharing the script)

Download and install AutoIt for making changes to this script, and building a executable file from it. With this script, assigning a dynamic computername is possible, without using MDT integration!

ConfigMgr rocks again!


Update 15-11-2011: Because of some comments that the script isn't working I replaced the script with additional values. This time the script must be functional again.

Update 16-3-2012: Again I replaced the script with additional values. In my environment the script is running fine.