Posted December 19th, 2011 by Matt Shadbolt
Fairly brief post today.
One of the many tasks an SCCM admin faces is checking for ConfigMgr duplicate computer records. There are many ways that we can get duplicate records, but here are the three most common:
Duplicate MAC Addresses.
I normally see this in environments where VDI is common. Generally, a VDI admin has duplicated machines without giving each a unique MAC address. This is bad and should be avoided. If you’re VDI admin has created a bunch of computers with the same MAC, we need to delete them from SCCM. To find these objects, run the following TSQL query:
SELECT dbo.v_RA_System_MACAddresses.MAC_Addresses0, Count(dbo.v_R_System.Name0)
AS SystemCount FROM dbo.v_R_System
RIGHT OUTER JOIN dbo.v_RA_System_MACAddresses ON dbo.v_R_System.ResourceID =
dbo.v_RA_System_MACAddresses.ResourceID GROUP BY
dbo.v_RA_System_MACAddresses.MAC_Addresses0 ORDER BY SystemCount DESC
Duplicate Computer Names.
These are the most common duplicate objects. Most likely this occurs due to OSD or conflicting discovery cycles. We basically end up with two computer objects, with the same name/hardware/MAC but different SMSBIOSGUID. It causes much confusion for ConfigMgr because it often doesn’t know how to process the inventory for the phantom object. To find these objects, create an SCCM Query (or query based collection) with the following Query Statement:
select R.ResourceID,R.ResourceType,R.Name,R.SMSUniqueIdentifier,
R.ResourceDomainORWorkgroup,R.Client from SMS_R_System as r
full join SMS_R_System as s1 on s1.ResourceId = r.ResourceId
full join SMS_R_System as s2 on s2.Name = s1.Name
where s1.Name = s2.Name and s1.ResourceId != s2.ResourceId
Duplicate HardwareID’s
One other way to look for dupes is to use the HardwareID. Use the following TSQL to find the objects with duplicate HardwareIDs:
SELECT Name0, Hardware_ID0, Count(Hardware_ID0) AS SystemCount
FROM dbo.v_R_System
GROUP BY Hardware_ID0, Name0
ORDER BY SystemCount DESC
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
No Responses
Posted September 22nd, 2011 by Matt Shadbolt
Quick post today.
Here’s a t-sql query to update a collection based on a specific Client Status Message. I’m sure you can think of many reasons why this would be handy.
SELECT SMS_R_SYSTEM.ResourceID,
SMS_R_SYSTEM.ResourceType,
SMS_R_SYSTEM.Name,
SMS_R_SYSTEM.SMSUniqueIdentifier,
SMS_R_SYSTEM.ResourceDomainORWorkgroup,
SMS_R_SYSTEM.Client
FROM sms_R_System
JOIN sms_statusmessage ON sms_R_System.netbios_name0 = sms_statusmessage.machinename
JOIN sms_StatMsgInsStrings ON sms_statusmessage.RecordID = sms_StatMsgInsStrings.RecordID
WHERE sms_statusmessage.messageid = "<Enter Status Message ID Here>"
AND sms_StatMsgInsStrings.InsStrValue = "<Enter Status Message Description Here>"
Change the <Enter Status Message ID Here>, and the <Enter Status Message Description Here> to the messages you are after, and save it as a Collection Membership Rule
.
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
Tags: Client Status Message, Collection Membership Rule
No Responses
Posted August 24th, 2011 by Matt Shadbolt
I haven’t posted for a while as I’ve been busy with my new
job
I’m now a Premier Field Engineer working for Microsoft on
our SCCM team. For more info on the PFE team visit www.microsoft.com/services.
So I thought I’d post one some info on one of the most used
SCCM tools – Trace32. I know just about every SCCM admin uses Trace32 to read
the copious amounts of SMS logs, but there are a couple of features that,
surprisingly, very few of my customers even know about!
Here we go:
Trace32’s Error Lookup feature
One of the more important but commonly missed features is
the Error Lookup option in Trace32’s Tools > Error Lookup (Ctrl + L) menu.

The Error Lookup tool will return descriptions of cryptic
error codes from:
Windows error codes


WMI error codes


Winhttp error codes

Trace32’s Merge selected files feature
When trying to troubleshoot specific issues such as site
replication issues, it’s sometimes necessary to open more than one log file at
once. Windows 7’s window snap feature makes viewing two logs side-by-side
really easy, but sometimes a more accurate timeline is needed between viewing
log files.
If you select Open in Trace32, Ctrl-click on multiple log
files in the open dialog box, tick Merge
selected files you will find that all the selected log files will merge
together into one large super log. The log entries are automatically sorted by
time so it’s super easy to see ConfigMgr process certain things and log the
progress across multiple logs.
In this quick example I’m just viewing the process for
finding a clients default management point.

As you can see, the client is logging to both LocationServices.log
and ClientLocation.log and it’s quite easy to read the timeline of what is
going on.
Trace32’s Last Directory registry key
Lastly, a minor but handy tip, Trace32 by default will save
the last log location that you opened. This is really handy as you don’t have
to browse to the logs path every time you want to read SMS logs. It is a bit of
a pain though when you use Trace32 on a client, because every time you launch
Trace32 for the first time on a certain machine, it defaults to the
%userprofile%\Desktop directory. The Last Directory registry found at
HKCU\Software\Microsoft\Trace32 is the key that controls the default open
location. If you add a GPO that updates your clients to %windir%\System32\CCM\Logs\
every time you jump on a machine it will automatically open Trace32 at the
client log location.
You can download the Trace32/64 tools as part of the ConfigMgr 2007 toolkit from http://www.microsoft.com/download/en/details.aspx?id=9257
.
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
Tags: ConfigMgr, SCCM, sms, Trace32
3 Responses
Posted April 28th, 2011 by Matt Shadbolt
Had an annoying one this afternoon. While trying to install the new (ish) SCCM 2012 Beta 2 the Updated Prerequisite Components wizard wouldn’t download the prereqs. I was able to run the setupdl.exe manually, but still when providing the prereq path to the Updated Prerequisite Components wizards it would still fail.
<04-28-2011 14:38:50> INFO: setupdl.exe: Start
<04-28-2011 14:38:50> INFO: setupdl.exe: Finish
Really easy fix in the end. You just need to make sure the prereqs are stored in a directory without any spaces in the name, and bingo. :/
.
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
No Responses
Posted April 21st, 2011 by Matt Shadbolt
ZDNet recently ran a case study on Enspire Australia’s new vBlock infrastructure. Check out the video of Geoffrey Nicolas and Ben Hodge – my ex-colleagues and long time friends.
http://www.zdnet.com.au/case-study-enspire-vblock-339313585.htm
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
No Responses
Posted March 8th, 2011 by Matt Shadbolt
I’m on a scripting rampage at the moment writing tools for the common things I do for each customer. Here’s my latest script.
CustomWinPEWIM.ps1
This powershell script will:
- Check for prereqs (WAIK, DISM)
- Builds the WinPE dev environment (in either x86 or x64)
- Mounts the WIM
- Prompts to install non-default WinPE packages (HTA or Script Host support, for example)
- Adds Trace32.exe to the image
- Prompts asking if you want to add any other files to the image
- Unmounts and saves the custom image ready for SCCM or MDT.
The script is quite long (217 lines) so I won’t paste it here like I normally do, see above to download the script directly.
.
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
Tags: Windows Boot Image, WinPE
One Response
Posted March 7th, 2011 by Matt Shadbolt
I’ve been working hard lately on the various USMT migration scenarios using SCCM with hardlinking and State Migration Points. One of the frustrating things during this process is creating ‘user state’. Creating user state for your test migrations is important as you need to ensure that your testing covers the regular places that users will store files, and that USMT is doing it’s job and migrating this data.
The frustrating part is the time it takes to create some reasonable user state. You want to add files and folders to users profiles across multiple locations. I’ve written a VB Script to automate this process. The script will work for either Windows XP or Windows 7 environments. It basically creates a bunch of files and folders in the logged in users Desktop, My Documents, My Pictures and App Data directories.
You can download the script here – but I’ll also post the contents so you can grab whatever you need.
'' USMT Environment Setup ''
'' Created by Matt Shadbolt ''
Option Explicit
'Declare Variables
Dim objFSO, objFolder, strDirectory
Dim objNetwork
Dim profilePath
Dim x
Dim filetxt, getname, path
Dim LocalAppDataPath, RoamingAppDataPath
Dim MyDocuments, MyDesktop, MyPictures
'Set Variables
x = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("WScript.Network")
profilePath = UserInput( "Is this for XP or WIN7?")
' Check if XP or Windows 7
If profilePath = "XP" Then
profilePath = "C:\Documents and Settings\"
LocalAppDataPath = "\Local Settings\Application Data\"
RoamingAppDataPath = "\Application Data\"
MyDocuments = "My Documents"
MyDesktop = "Desktop"
MyPictures = "My Documents\My Pictures"
ElseIf profilePath = "WIN7" Then
profilePath = "C:\Users\"
LocalAppDataPath = "\AppData\Local\"
RoamingAppDataPath = "\AppData\Roaming\"
MyDocuments = "Documents"
MyDesktop = "Desktop"
MyPictures = "Pictures"
Else
MsgBox "You need to enter either XP or WIN7 (CaSe SeNsItIvE) "
Wscript.Quit
End If
' Desktop Folders
While x < 10
strDirectory = profilePath & objNetwork.Username & "\" & MyDesktop & "\DesktopFolder" & x
Set objFolder = objFSO.CreateFolder(strDirectory)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "TextFile" & x & ".txt", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc" & x & ".doc", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "Shortcut" & x & ".lnk", True)
x = x + 1
Wend
x = 0
' My Documents
While x < 10
strDirectory = profilePath & objNetwork.Username & "\" & MyDocuments & "\DocumentsFolder" & x
Set objFolder = objFSO.CreateFolder(strDirectory)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc" & x & ".doc", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc1" & x & ".doc", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc2" & x & ".doc", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc3" & x & ".doc", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc4" & x & ".doc", True)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "WordDoc5" & x & ".doc", True)
x = x + 1
Wend
x = 0
' My Pictures
While x < 10
strDirectory = profilePath & objNetwork.Username & "\" & MyPictures & "\PicturesFolder" & x
Set objFolder = objFSO.CreateFolder(strDirectory)
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "Picture" & x & ".jpg", True)
x = x + 1
Wend
x = 0
' AppDatat\Local
strDirectory = profilePath & objNetwork.Username & LocalAppDataPath & "SomeAppData"
Set objFolder = objFSO.CreateFolder(strDirectory)
While x < 10
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "AppDataFile" & x & ".appData", True)
x = x + 1
Wend
x = 0
' AppData\Roaming
strDirectory = profilePath & objNetwork.Username & RoamingAppDataPath & "SomeAppData"
Set objFolder = objFSO.CreateFolder(strDirectory)
While x < 10
Set filetxt = objFSO.CreateTextFile(strDirectory &"\" & "AppDataFile" & x & ".appData", True)
x = x + 1
Wend
x = 0
MsgBox "Success!"
''' Functions '''
'Input OS type
Function UserInput( myPrompt )
If UCase( Right( WScript.FullName, 12 ) ) = "\CSCRIPT.EXE" Then
WScript.StdOut.Write myPrompt & " "
UserInput = WScript.StdIn.ReadLine
Else
UserInput = InputBox( myPrompt )
End If
End Function
.
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
No Responses
Posted January 18th, 2011 by Matt Shadbolt
I was wondering today about Windows 7′s network status icon in the system tray and how it tells if there is an Internet connection present. For example, you may have a very strict firewall or proxy that only allows certain sites. In that instance, how does the computer tell if it *actually* has an Internet connection or not?

The image above is a screen cap from one of my lab virtual machines. This lab doesn’t have internet access… but I was wondering how I could trick it into reporting a successful connection.
After some digging, I found the answer. This feature is called Network Connectivity Status Indicator (NCSI) and was introduced with Windows Vista. The NCSI periodically connects to a dedicated Microsoft server and if it is able to connect, reports “Internet Access”
Now, how can we trick it into thinking there is a connection? Easily!
First, you need to change your hosts file to localhost loop the address www.msftncsi.com

This will cause any DNS name lookup on the local computer to resolve it’s own localhost address instead of Microsofts external server. In this case, the server doesn’t have an Internet connection and wont be able to resolve the external address anyway.
Next, we need to simulate the www.msftncsi.com site. Open IIS and create a simple static website with the www.msftncsi.com host header.

The IIS site above will mean any time http://www.msftncsi.com is browsed to – in conjunction with the host file addition – the site will be served by the local server your working on. We now need one last change for the NCSI status to change.
Open Notepad.exe and create the following file in the root of the www.msftncsi.com website – ncsi.txt

In this text file, type only the following – no extra lines or returns
Microsoft NCSI
Now disable and enable your Local Area Connection. This should cause NCSI to attempt to connect to http://www.msftncsi.com/ncsi.txt and read the single line. Of course, instead of failing due to no Internet connection, NCSI will successfully connect to your local IIS site and report a successful Internet connection!

OR, if your the super boring type… you COULD just change the following registry key to 0 to disable NCSI altogether – but that’s no fun now is it?
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
3 Responses
Posted December 16th, 2010 by Matt Shadbolt
Here’s a quick and dirty VBScript to find the domain of a certain computer. Great for things like SCCM OS Deployment.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
Wscript.Echo "Domain: " & objComputer.Domain
Next
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
No Responses
Posted October 26th, 2010 by Matt Shadbolt
I’m a big fan of BackBlaze (www.backblaze.com) and I use it to backup all of my machines. One thing that *really* annoys me though, is that by default, BackBlaze will backup your entire hard drive contents.This is a real pain for those who have lots of large files with no need for backup copies in the cloud.
Even worse, there is no option in the control panel to exclude all files except certain folders – for example your My Documents folder. Instead, you need to manually enter each folder across your hard drive that you want to exclude, and only leave the single folder that you want to backup out.
Here’s an easy way to exclude all files except your My Documents directory (or any other directory you want backed up)
First, browse to C:\ProgramData\Backblaze\bzdata (in Windows Vista/7), and open the BZInfo.xml document in Notepad. Now find the do_backup section – it should look something like
<do_backup dst_type=”bzdatacenter” dst_fileformat=”bzff” max_filesize_mb=”4000″ net_throttle=”50″ backup_schedule_type=”continuously” backup_schedule_detail=”none” >
<bzdirfilter dir=”c:\” whichfiles=”all” />
<bzdirfilter dir=”c:\windows\” whichfiles=”none” />
<bzdirfilter dir=”c:\i386\” whichfiles=”none” />
<bzdirfilter dir=”c:\users\all users\microsoft\” whichfiles=”none” />
<bzdirfilter dir=”c:\users\all users\microsoft help\” whichfiles=”none” />
<bzdirfilter dir=”c:\$recycle.bin\” whichfiles=”none” />
<bzdirfilter dir=”c:\$recycler\” whichfiles=”none” />
<bzdirfilter dir=”c:\recycler\” whichfiles=”none” />
<bzdirfilter dir=”c:\msocache\” whichfiles=”none” />
<bzdirfilter dir=”c:\program files\” whichfiles=”none” />
<bzdirfilter dir=”c:\program files (x86)\” whichfiles=”none” />
</do_backup>
There are two settings in the config above that control what BackBlaze is backing up
<bzdirfilter dir=”c:\” whichfiles=”all” /> This line enables backup for all files across the C drive
<bzdirfilter dir=”c:\windows\” whichfiles=”none” /> This line disables backup for all files located in C:\Windows\
So, if we change the <bzdirfilter dir=”c:\” whichfiles=”all” /> to <bzdirfilter dir=”c:\” whichfiles=”none” /> and add a line above the edited line, including the folder we want backed up, BackBlaze will exclude all files on C except the directory we allow.
In my example, I want to exclude everything on C drive except My Documents. My BZInfo.xml file looks like
<do_backup dst_type=”bzdatacenter” dst_fileformat=”bzff” max_filesize_mb=”4000″ net_throttle=”50″ backup_schedule_type=”continuously” backup_schedule_detail=”none” >
<bzdirfilter dir=”C:\Users\MattShadbolt\Documents\” whichfiles=”all” />
<bzdirfilter dir=”c:\” whichfiles=”none” />
<bzdirfilter dir=”c:\windows\” whichfiles=”none” />
<bzdirfilter dir=”c:\i386\” whichfiles=”none” />
<bzdirfilter dir=”c:\users\all users\microsoft\” whichfiles=”none” />
<bzdirfilter dir=”c:\users\all users\microsoft help\” whichfiles=”none” />
<bzdirfilter dir=”c:\$recycle.bin\” whichfiles=”none” />
<bzdirfilter dir=”c:\$recycler\” whichfiles=”none” />
<bzdirfilter dir=”c:\recycler\” whichfiles=”none” />
<bzdirfilter dir=”c:\msocache\” whichfiles=”none” />
<bzdirfilter dir=”c:\program files\” whichfiles=”none” />
<bzdirfilter dir=”c:\program files (x86)\” whichfiles=”none” />
</do_backup>
And that’s how to enable individual directory backup with BackBlaze. If you have more than one folder, just add the directory to the do_backup list.
One other thing to note. BackBlaze by default has a maximum backup file size of 4GB. If (for some reason) you want to exceed this file size limit, just change the max_filesize_mb=”4000″ option in do_backup. For example, lets make the maximum file size large enough to backup a DVD ISO
<do_backup dst_type=”bzdatacenter” dst_fileformat=”bzff” max_filesize_mb=”6000″ net_throttle=”50″ backup_schedule_type=”continuously” backup_schedule_detail=”none” >
Hopefully this helps some of those BackBlaze users out there! As I said earlier, I’m a big fan of BackBlaze, but it would be nice if they enabled these settings out of the box.
.
Posted by Matt Shadbolt
http://mattlog.net
Please comment or click an ad to support this site
Tags: BackBlaze, Backup, Backups
3 Responses