When Software Updates fail to install here is a quick trick you can try

We all had issues with software updates that fail to install and the errors in the logs are not very intuitive or are misleading. Sometimes you suspect a corruption in the Windows Update Agent on the client machine.

What can you do?

Here is a quick and easy to implement trick: I would suggest to  try and reinitialize the Windows Update Agent.

Open Comand Prompt with administrative rights and execute following commands.

– net stop wuauserv

– rd C:\windows\SoftwareDistribution /S /Q

-net start wuauserv

You can also try and reset all the Windows Update components on that machine:

REGSVR32 %windir%\system32\wuapi.dll

REGSVR32 %windir%\system32\wuaueng1.dll

REGSVR32 %windir%\system32\wuaueng.dll

REGSVR32 %windir%\system32\wucltui.dll

REGSVR32 %windir%\system32\wups.dll

Here is a detailed description on how to do reset all Windows Update components, but in most cases the regeneration of SoftwareDistribution folder solves  a lot of issues.

 

Capturing MIF Files during Hardware Inventory troubleshooting

During hardware inventory troubleshooting you needed for sure to collect and analyse a mif file that is not collected  in the BADMIFs folder(e.g.  good case to compare with the bad case).

Here is how you can do it:

First you need to(on the site server) :

Stop SMS Executive

Rename Dataldr.dll

Start SMS Executive

You can also use ARCHIVE_REPORTS.SMS   that you create on the client to collect the XML file that will be sent from the client to the management point(more info on how to do it in this blog)

mif1

Now Trigger Full HWD. It is advisable to do full inventory cycle instead of just delta cycle if you need to see what gets collected.

When we see in the MP_Hinv.log that the XML got processed for that client, than we search for the MIF Files:

mif2

The file name is:

We can look in the :inboxes\auth\dataldr.box

You can now copy the mif file corresponding to the Client Name and rename dataldr.old back to dataldr.dll and restart SMS Executive.

Stop SMS Executive

Rename Dataldr.dll

Start SMS Executive

Once done the Mif backlog in inboxes\auth\dataldr.box should be processed in seconds:

You can now compare the MIF with the XML file or good case MIF with bad case mif.

Script: Configuration Manager 2012/2007: Move WMI to a standalone host and increase the MemoryPerHost, MemoryAllHosts and HandlesPerHost.

From time to time we come across the need to fine tune WMI as we are experiencing issues.

The following is an example of how to achieve this:

 In this example, we created two scripts, one which increases the handles per host, memory per host, memory for all hosts, and the other one which calls the first one and moves the WMI to a new standalone svchost and restarts the services (WMI and SMS Agent Host). The first script was adapted from the one provided here: http://social.technet.microsoft.com/wiki/contents/articles/6563.configmgr-sccm-how-to-increase-wmi-default-memory-allocation.aspx

Here is the sample on how the scripts are built

script

The scripts contain following lines:

script1

The values are 1 GB for MemoryPerHost and 2 GB for MemoryAllHosts. Also HandlesPerHost will be changed to 8192. These values can be adapted to whatever value suits you best:

script2jpg

What is highlighted should be omitted (Wscript can be used for testing purposes and check the results).

Next we need to create a package which contains a program that will run following comand line:

script3

Of course, stopping the WMI service will also stop the SMS Agent Host Service which will result in reporting the Package failed on the client. But the scripts will run and the values will be configured.
On the Client side we will be able to see during the execution:

script4

After SMS Agent Host will restart (last line of the script) we can see that the execution is reported as failed:

script5

Im cache we see:

script6

 It is absolutely necessary to have as last line in the BAT file a command to start the SMS Agent Host, or the client will not be started. (net start “SMS Agent Host”).

 The result of the first script is:

script7jpg

The second one will result in:

script8

This can be accomplished also by configuring a startup script or GPO, but we wanted to prove that it is possible also with Config Mgr.

Below is a sample of how to accomplish this via Config Mgr and scheduled tasks. For operating systems previous Windows 2000 you can use AT command. We will use schtasks.exe as we tested this on Windows 2008 R2 operating system. For more info about schtasks.exe please read http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357(v=vs.85).aspx

We create an extra script named ScheduleTask.bat:

script9

What the script does is following:

  • It will create a folder on the root drive named TestWMI
  • It will copy all files in the current folder, which is the package folder in the client cache
  • It will create a task named TestWMI that will start WMISTandAlone.Bat that will be located in C:\testWMI folder. Also we specified to run only once and it will run at 14:00.

In the program we will use this script:

script10

After deploying the package to clients we will be able to see something like this:

script11

After running it we will be able to see that it was executed successfully, but this means we created a task that will run the WMI scripts previously discussed. By creating a task that will run only once we can successfully deploy the package to Config Mgr clients that will configure the WMI settings.

script12

You can also check if the task was created successfully:

script13

****************************************************************************’ Disclaimer

‘ This sample is not supported under any Microsoft standard support program or service. This sample  is provided AS IS without warranty of any kind.  The entire risk arising out of the use or performance of this sample and documentation’ remains with you. In no event shall  its authors, or anyone else involved in the creation, production, or delivery of this sample be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other  pecuniary loss) arising out of the use of or inability to use this  sample or documentation.’

‘****************************************************************************

 

 

 

 

 

 

 

 

 

 

 

 

Best practices and recommendations for System Center 2012 Configuration Manager.

Please check and read regularly the Best Practices recommendations for System Center 2012 Configuration Manager.

WMI fine tuning for Config MGr

When you are using Config Mgr there will be a moment when WMI is not behaving as it should. After  some troubleshooting, you will reach the point when you will decide to fine tune WMI.

There are two main possibilities on how to fine tune.

One is to move the  WMI service to a stand alone host (svchost) and the second is to  increase the memory and handle quotas in the WMI provider service. These will ensure that WMI will run more stable and will not crash that often

So let us address the first topic ( move the  WMI service to a stand alone host ). This will improve the performance of the Configuration Manager Console as well. You can do it in three different ways:

1)net stop winmgmt
winmgmt /standalonehost
net start winmgmt

OR

2)net stop winmgmt
sc config winmgmt type= own
net start winmgmt

OR

3) According to http://support.microsoft.com/kb/2002335

net stop winmgmt
rundll32 %WINDIR%\system32\wbem\WMISvc.dll, MoveToAlone
net start winmgmt
Afterwards the Server must be rebooted to make the changes effective! In order to verify if the the WinMgmt has been relocated successfully into a separate SVCHOST the following command can be used: Tasklist /SVC

Detailed information on this can be found here <http://blogs.msdn.com/b/haoweiqin/archive/2012/01/25/10260412.aspx>

 

The second method will be addressed  now:
We will need to change values in __ProviderHostQuotaConfiguration Class:
1) Open WBEMTEST on the affected machine(other toolscan also be used).
2) Connect to “root” (no sub path).
3) Click “Enum Classes…”, enter ““__ProviderHostQuotaConfiguration ” as the superclass name and leave “Immediate only” selected. Click OK.
4) Double-click the “__ProviderHostQuotaConfiguration” entry.
5) Click “Instances”.
6) Double-click the one instance to bring up the instance properties.
7) Check the “Hide System Properties” box.
8) Double-Click the MemoryPerHost property and change the memory amount to a greater number, such as 512 MB (536870912 bytes).If it is already 512 MB you can multiply it by 2 or 4 and set 1 GB or 2 GB. Make sure that MemoryAllHosts is greater than MemoryPerHost, or you can raise that too, if memory permits
9) Double-Click the HandlesPerHost property and change the memory amount to a greater number, such as 16384
As an example you have this
Default Values(e.g.):

instance of __ProviderHostQuotaConfiguration
{
HandlesPerHost = 4096;
MemoryAllHosts = “1073741824”;
MemoryAllHosts = “2147483648”;
MemoryPerHost = “536870912”;
MemoryPerHost = “134217728”;
ProcessLimitAllHosts = 32;
ThreadsPerHost = 256;
};
New Values
instance of __ProviderHostQuotaConfiguration
{
HandlesPerHost = 8192;
MemoryAllHosts = “2147483648”;
MemoryPerHost = “1073741824”;
ProcessLimitAllHosts = 32;
ThreadsPerHost = 256;
};

You can also find  more information about this method  on this TechNet blog or on this one. There is also this nice TechNet Wiki article that originates from anoopcnair.com

Here is an automated solution

How to trigger a full machine policy cycle (policy reset) on a Config Mgr client(2007/2012)

There might come a time when the Config Mgr Client Agent does not behave as you would expect, or you suspect that the policies are not acurate.
In this case you could try to repair the WMI , or clean reinstall the client.
The alternative bevore doing those time consuming and risky steps is to  trigger a full machine policy cycle (policy reset)

There are two possibilities  :

  • do a policy reset cycle

wmic /namespace:\\root\ccm PATH SMS_Client CALL TriggerSchedule “{00000000-0000-0000-000000000113}” /nointeractive

  •  do  hard policy reset on the affected client:

WMIC /Namespace:\\root\ccm path SMS_Client CALL ResetPolicy 1 /NOINTERACTIVE

A detailed list of TechNet articles for Config Mgr Migration

Migration

·         Introduction to Migration in System Center 2012 Configuration Manager

·         Prerequisites for Migration in System Center 2012 Configuration Manager

·         Administrator Checklists for Migration Planning in System Center 2012 Configuration Manager

·         Configuring Migration to System Center 2012 Configuration Manager

·          Operations for Migrating Configuration Manager 2007 to System Center 2012 Configuration Manager

·         Migrating from Configuration Manager 2007 to System Center 2012 Configuration Manager

·         Introduction to Migration in System Center 2012 Configuration Manager

·         Planning for Migration to System Center 2012 Configuration Manager

·         Prerequisites for Migration in System Center 2012 Configuration Manager

·         Administrator Checklists for Migration Planning in System Center 2012 Configuration Manager

·         Determine Whether to Migrate Configuration Manager 2007 to System Center 2012 Configuration Manager

·         Planning for Source Hierarchies in System Center 2012 Configuration Manager

·         Planning for Migration Jobs in System Center 2012 Configuration Manager

·         Planning for Client Migration to System Center 2012 Configuration Manager

·         Planning for Content Deployment During Migration to System Center 2012 Configuration Manager

·         Planning for the Migration of Configuration Manager 2007 Objects to System Center 2012 Configuration Manager

·         Planning to Monitor Migration Activity in System Center 2012 Configuration Manager

·         Planning to Complete Migration to System Center 2012 Configuration Manager

·         Configuring Migration to System Center 2012 Configuration Manager

·         Operations for Migrating Configuration Manager 2007 to System Center 2012 Configuration Manager

·         Security and Privacy for Migration to System Center 2012 Configuration Manager

Here is also a virtual lab where you can test a Config Mgr migration: TechNet Virtual Lab: System Center 2012 Configuration Manager: Migrating from Configuration Manager 2007 to Configuration Manager 2012

Automated solution to get all the installed updates for a computer out of the Config Mgr Database(when not using reports)

So let us say you need an automated solution to get all the installed updates for a computer, but do not want to use reports, nor get your hands dirty and go in the database and check things out. You also do not want to check this on each client individually, or remotely connect to them in order to look for this information.
What can you do?

You can create a  script that receives as a parameter the computer name and provides back a text file with the installed updates(Bulletin Id and title).

The script will look like this.

skript1

What you will need to do is only change the  $database variable to point to your Config Mgr database.

The nice feature that ensures that you do not need to specify any credentials in the script for the connection to tha database is that we use integrated credentials(it uses the users credentials that runs the script so you need to make sure this user has suffiction rights on the DB) $connectionString = “Server=$dataSource;Database=$database;trusted_connection=true;”

 

You can call it like this

call script

NOTE You will need to run the script on the Server where the SQL Server stores your Config Mgr database

The output will look like this:

output

Of course , the script can be adapted to put the data into a CSV file or to contain more information. The article is intended only to provide you with an example on how to do it.

 

Here is also the script:

param([string]$PCname )

$dataSource = “.”

$database = “CM_R2S”

$connectionString = “Server=$dataSource;Database=$database;trusted_connection=true;”

$query = “SELECT dbo.v_UpdateInfo.BulletinID, dbo.v_UpdateInfo.Title FROM dbo.v_Update_ComplianceStatus INNER JOIN dbo.v_UpdateInfo ON dbo.v_Update_ComplianceStatus.CI_ID = dbo.v_UpdateInfo.CI_ID INNER JOIN dbo.System_DISC ON dbo.v_Update_ComplianceStatus.ResourceID = dbo.System_DISC.ItemKey WHERE (dbo.v_Update_ComplianceStatus.Status = 3) AND (dbo.System_DISC.Netbios_Name0 LIKE ‘$PCname‘ )”

$connection = New-Object System.Data.SqlClient.SqlConnection

$connection.ConnectionString = $connectionString

#$connection.ConnectionString = “Server=$dataSource;Database=$database;Integrated Security=True;”

$connection.Open()

$command = $connection.CreateCommand()

$command.CommandText = $query

$result = $command.ExecuteReader()

$table = new-object “System.Data.DataTable”

$format = @{Expression={$_.BulletinID};Label=“BulletinID”;width=15},@{Expression={$_.Title};Label=“Title”; width=200}

$table.Load($result)

$dateiname=$PCname.txt”

$table | format-table $format | Out-File $dateiname

$connection.Close()