System Center Configuration Manager 2007 backups fail with Win32 Error = 145

Microsoft System Center Configuration Manager 2007 backups may fail if other VSS-aware backup software is scheduled to run concurrently. In this scenario, the Smsbkup.log will show entries similar to the following:
Deleting E:\SMSbackup\SiteServer\SMSServer\inboxes\auth\statesys.box\incoming, FAILED, Win32 Error = 145
Deleting E:\SMSBackup\SiteServer\SMSServer\inboxes\auth\ddm.box, FAILED, Win32 Error = 145
Deleting E:\SCCMBackup\Backup, FAILED, Win32 Error = 145
Failed to delete the contents of the backup folder. Error Code = 0x0 SMS_SITE_BACKUP
Error: Deleting the existing files in the backup location failed... SMS_SITE_BACKUP
SMS site backup failed. Please see previous errors. SMS_SITE_BACKUP
SMS site backup service is stopping. SMS_SITE_BACKUP
These errors can occur if the Volume Shadow Copy Service (VSS) provider is in use by another process. Configuration Manager Backup expects to have exclusive access to these resources when performing a backup.

To prevent these errors, configure Configuration Manager Backup to start at a time outside the window for other backup jobs on the server. The schedule for this can be found in the Configuration Manager Console under Site Management -> Site Code -> Site Settings -> Site Maintenance -> Tasks -> Backup ConfigMgr Site Server.

For all the details and the latest version of this document please see the following new Knowledge Base article:

KB2387913 - System Center Configuration Manager 2007 backups fail with Win32 Error = 145

How to verify Management Point is working fine in SCCM 2007

Verify Management Point Installation Logs

1. Verify MPsetup.log. Make sure MP is install successfully, if not resolve the problem. If you find any problem in MPSetup.log, then verify MPMSI.log for more information on the issue.

MPSetup.log:
<12-16-2008 17:12:09> Installing the SMSMP
<12-16-2008 17:12:09> Passed OS version check.
<12-16-2008 17:12:09> IIS Service is installed.
<12-16-2008 17:12:09> SMSMP already installed (Product Code: {3945C886-9779-4280-B537-AB8E62A0878E}). Upgrading/Reinstalling SMSMP
<12-16-2008 17:12:09> New SMSMP is a new product code {{7AF53388-F428-4A8B-8F20-DBB4851E3424}}. This is a major upgrade.
<12-16-2008 17:12:09> Enabling MSI logging. mp.msi will log to D:\SMS\logs\mpMSI.log
<12-16-2008 17:12:09> Installing D:\SMS\bin\i386\mp.msi REINSTALLMODE=vmaus CCMINSTALLDIR=”D:\SMS_CCM” CCMSERVERDATAROOT=”D:\SMS” USESMSPORTS=TRUE SMSPORTS=80 USESMSSSLPORTS=TRUE SMSSSLPORTS=443 USESMSSSL=TRUE SMSSSLSTATE=0 CCMENABLELOGGING=TRUE CCMLOGLEVEL=1 CCMLOGMAXSIZE=1000000 CCMLOGMAXHISTORY=1
<12-16-2008 17:15:59> mp.msi exited with return code: 0
<12-16-2008 17:15:59> Verifying CCM_CLIENT virtual directory.
<12-16-2008 17:15:59> Website path is IIS://LocalHost/W3SVC/1.
<12-16-2008 17:15:59> Connecting to IIS.
<12-16-2008 17:15:59> CCM_CLIENT is currently D:\SMS\Client
<12-16-2008 17:15:59> Installation was successful.
2. Check IIS and make sure that you have virtual directory named SMS_MP under default website.
3.Check mpcontrol.log and find if you have below sucesses status message (Status Code 200). ( I use tracert32 to read log files)
Call to httpsendrequestsync succeeded for port 80 with status code 200,text ok
http test request succeeded

successfully performed Management Point avaialbility check against local computer

4. Fianlly for testing run this on IE from any client and from the server itself and you sould get the results mentioned.

  a) Run http://<MP Name>/sms_mp/.sms_aut?mplist

   This returns a list of MP's installed on this site including the secondary site MP's.

  b) Run http://<MP Name>/sms_mp/.sms_aut?mpcert

   This returns a long list of numbers and letters.

Output of Step a
- <MPList>
- <MP Name="smsserver1" FQDN="smsserver1.example.abc.com">
<Version>6487</Version>
<Capabilities SchemaVersion="1.0" />
</MP>
- <MP Name="smsserver18" FQDN="smsserver18.example.abc.com">
<Version>6487</Version>
<Capabilities SchemaVersion="1.0" />
</MP>
- <MP Name="smsserver2" FQDN="smsserver2.example.abc.com">
<Version>6487</Version>
<Capabilities SchemaVersion="1.0" />
</MP>
- <MP Name="secondary1" FQDN="secondary1.example.abc.com">
<Version>6487</Version>
<Capabilities SchemaVersion="1.0" />
</MP>
</MPList>
More Info on MP and resolving issues:

http://technet.microsoft.com/en-us/library/cc180197.aspx
http://technet.microsoft.com/en-us/library/cc180195.aspx 
 
 

Determine which NTFS drive should have distribution point

First time when you distribute the package to distribution point then SMS/SCCM chooses the NTFS drive which has maximum free space.If you have 2 to 3 NTFS drives and you want to chosse one of them. There is no provision given at SMS/SCCM server side to prevent SMS/SCCM from using a NTFS dirve with maximum free space. Also, if any drive that is currently being used for distribution point is full, then SMS/SCCM starts using the next available drive with maximum.

Method 1:

Create the blank text file on the other drives with the name NO_SMS_ON_DRIVE.SMS which will prevent respective NTFS drive from creating SMSPKGC$ (Here C represents the drive) folder.This file named NO_SMS_ON_DRIVE.SMS needs to be placed at the root of the drive you want excluded.Drive which dont has NO_SMS_ON_DRIVE.SMS file,will have SMSPKGC$ folder.
 
Method 2:

Insted of installing a standard distribution point,install a distribution point on a server share.

1) Create a folder called smspkgx$ on the partition you want it and share that folder. (x is the drive letter of your choice).

2) Create the distribution point on a share basis in the sms admin console instead of on a server name. (Share has to exist). Just right-click site systems inside the sms admin console, select new, server share, ...)


Microsoft Article: http://support.microsoft.com/kb/871234

Rebuilding and reinstalling the WMI Repository

If you experience behavior when using WMI, such as application errors or scripts that used to work are no longer working, you may have a corrupted WMI repository. To fix a corrupted WMI repository, use these steps:

Windows XP and Windows Vista

Click Start -> Run and type CMD.EXE
Note: In Windows Vista, you need to open an elevated Command Prompt window. To do so, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

Type this command and press Enter:

net stop winmgmt

Using Windows Explorer, rename the folder %windir%\System32\Wbem\Repository. (For example, %windir%\System32\Wbem\Repository_bad). %windir% represents the path to the Windows directory, which is typically C:\Windows.

Switch to Command Prompt window, and type the following and press ENTER after each line:
net start winmgmt
EXIT

For Windows XP Service Pack 2 and Service Pack 3

Click Start, Run and type the following command:
rundll32 wbemupgd, UpgradeRepository

This command is used to detect and repair a corrupted WMI Repository. The results are stored in the setup.log (%windir%\system32\wbem\logs\setup.log) file.

For Windows Vista

Open an elevated Command Prompt window. To do so, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.
Type the following command:

winmgmt /salvagerepository

The above command Performs a consistency check on the WMI repository, and if an inconsistency is detected, rebuilds the repository. The content of the inconsistent repository is merged into the rebuilt repository, if it can be read.

For Windows Server 2003

Use the following command to detect and repair a corrupted WMI Repository:

rundll32 wbemupgd, RepairWMISetup

Re-registering the WMI components

The .DLL and .EXE files used by WMI are located in %windir%\system32\wbem. You might need to re-register all the .DLL and .EXE files in this directory. If you are running a 64-bit system you might also need to check for .DLLs and .EXE files in %windir%\sysWOW64\wbem.

To re-register the WMI components, run the following commands at the command prompt:
  • CD %windir%\system32\wbem
  • for /f %s in ('dir /b /s *.dll') do regsvr32 /s %s
  • for /f %s in ('dir /b *.mof') do mofcomp %s 
Registering WMI Service itself

Open the command console, type "net stop winmgmt". When you get the warning that other services need to be stopped type 'Y' and continue.

Open 'My Computer' and then go to the folder '%SystemRoot%\System32\WBEM\Repository' and delete that folder.

Reboot your system.

After you login, open the command console, and type the following commands in order: 

winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf
Note: If this doesn't fix the problem, you need to try reinstalling Comprehensive rebuild method.

Comprehensive rebuild method

Important note: If you've installed a Service Pack, you need to insert your Windows XP CD with Service Pack integration (called as the Slipstreamed Windows XP CD). If you don't have one, you may point to the %Windir%\ServicePackFiles\i386 folder for a recent version of the system files required during WMI repair. Or you may create a slipstreamed Windows XP CD and insert it when prompted.


Click Start, Run and type the following command, and press ENTER:

rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf

Insert your Windows XP CD into the drive when prompted. Repair process should take few minutes to complete. Then restart Windows for the changes to take effect.

Note that none of the above two methods restore the missing files related to Windows Management Instrumentation (WMI). So, below is a comprehensive repair procedure that restores all the missing WMI modules. In case of missing WMI modules, you may use the following method.

Repair WMI using BAT File:

Most of the WMI problems can be solved by rebuilding the WMI Repository, re-registering the WMI components. To automate this, you could create a BAT file. Copy the following lines to a text file and save it with .BAT extension and run it to fix common WMI issues.
net stop winmgmt /y
%SYSTEMDRIVE%
CD %windir%\system32\wbem
rd /S /Q repository
net start winmgmt
for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s
for /f %%s in ('dir /b *.mof') do mofcomp %%s

SCCM WSUS Synchronization failed!

Error in wsyncmgr.log:
Sync failed: LocalDBOtherError: SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.~~at Microsoft.UpdateServices.DatabaseAccess.DBConnection.DrainObsoleteConnections(SqlException e). Source: Microsoft.SystemsManagementServer.SoftwareUpdatesManagement.WSyncAction.WSyncAction.SyncWSUS
 
Resolution:
Clean the WSUS and maintain WSUS.
 
Here are two methods that should be used to maintain a WSUS hierarchy:
Re-index the WSUS 3.0 Database

http://gallery.technet.microsoft.com/ScriptCenter/en-us/6f8cde49-5c52-4abd-9820-f1d270ddea61

Run the Re-Index monthly. This can be run in any order within the hierarchy since it simply improves performance of WSUS database.
 NOTE: In addition to the steps covered in the link above, the following changes may be required:
  • If you are hosting the WSUS database (SUSDB) on a full SQL server instead of using Windows Internal Database (WIDS), you can simply run the re-index as a SQL query using SQL Management Studio
  • On a Windows Server 2008 R2 server, you have to update the recommended command line to the following to get the script to work with WIDS:
sqlcmd -i WSUSDB.sql -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -E -I

You also have to install the SQL Native Client and the SQLCMD utility from http://www.microsoft.com/downloads/details.aspx?familyid=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en
Run the WSUS Server Clean-Up Wizard
  • You MUST run the WSUS Server Clean-up Wizard from the bottom of the WSUS hierarchy to the top and NEVER from the top down.
  • You should run the WSUS Server Clean-Up Wizard throughout the hierarchy on a monthly basis. To help with this effort, you may want to automate the wizard using any of the following:
  • PowerShell script sample for accessing the WSUS API for the cleanup functions: http://gallery.technet.microsoft.com/ScriptCenter/en-us/fd39c7d4-05bb-4c2d-8a99-f92ca8d08218
  • Sample tool that handles the WSUS Cleanup wizard functions and offers a method to call the WSUSDBMaintenance script which can be useful if you run it as a scheduled task from the bottom of the hierarchy to the top on a monthly basis: http://wsus.codeplex.com/releases/view/17612
How to Run WSUS Cleanup Wizard:
 To run the Server Cleanup Wizard

In the WSUS administration console, select Options, and then Server Cleanup Wizard.
  1. By default this wizard will remove unneeded content and computers that have not contacted the server for 30 days or more. Select all possible options, and then click Next.
  2. The wizard will begin the cleanup process, and will present a summary of its work when it is finished. Click Finish to complete the process.



How to use Preload Package Tool for Configuration Manager 2007 to load package on SCCM Site

The Preload Package Tool (PreloadPkgOnSite.exe) is used to manually install compressed copies of software distribution package source files on Configuration Manager 2007 sites. After package source files are installed, a status message is sent up the site hierarchy indicating the presence of the new package source files. This avoids sites higher in the hierarchy from copying package source files over the network when distribution points at child site are selected to host software distribution package content that has already been preloaded on them.

  • Copy .PCK files from a backup location to the distribution point share (Ex c:\smspkg) on the site manually. After manually copying the files, ensure that the read-only NTFS file attribute for the .PCK file is set.
  • Copy PreloadPkgOnSite.exe file to the distribution point share directory (c:\smspkg) on the child site that you wish to preload compressed software distribution package source (.PCK) files.
  • From a command prompt, run the tool using the following syntax:
    PreloadPkgOnSite.exe [PkgID]
    This command need to be run for each PCK files that need to be loaded on the secondary site.
Running this command will update necessary software distribution package source location information for the site and forward this information up the hierarchy.
  • Open the System Center Configuration Manager
  • Drill down and choose the central site from where the packages need to be distributed
  • Choose:
         Systems Center Configuration Manager
                 ->Site Database (site code - site name)
                           ->Computer Management
                                     -> Software Distribution
                                             -> Packages
  • Select the package that needs to be distributed to the site.

         Right click on the package.

         Select Manage Distribution Points
  • In the Welcome screen

           Click Next


  • In the Select Destination Distribution Point
Select Copy the package to new distribution points
  • Click Next
  • In the Package page
         Select the SCCM Site where you need to distribute the package.
         Click Next
         In the Completion Page
         Click Next
  • In the Confirmation Page
            Click Close
  • Repeat these Step for each package that need to be distributed to the SCCM Site.
  • Review the distmgr.log on SCCM sites to ensure that all the package are successfully distributed to the SCCM site.

Creating dynamic collection by selecting objects not in a collection

If you are interested in a way of retrieving objects into a collection that don't exist in another collection, it's actually not very difficult. For example, you have a collection of clients with antivirus. Now you want to create a collection of clients that do not have antivirus. Instead of creating a new one, you run subselect to bring back all the clients that are not in the original antivirus collection.

The only thing you have to know is the collection id of the collection that you want to check. For the samples below, note that [collid] is a generic tag for your collection ids. If you examine the root\sms\site_ of your sms server, you'll see a list of sms collections labeled with:

 sms_cm_res_coll_[collid]

This is what you need to build your subselect query. If you query this in wbemtest, with something like select * from sms_cm_res_coll_[collid] you should get back a list of resource ids which look something like this
 ...
sms_cm_res_coll_[collid].resourceid=1
sms_cm_res_coll_[collid].resourceid=2
sms_cm_res_coll_[collid].resourceid=3
sms_cm_res_coll_[collid].resourceid=4
sms_cm_res_coll_[collid].resourceid=5
...

or something similar... I was showing that part just to demonstrate that querying the collection id from wmi in this manner, does indeed produce the members of the collection. now to put it all together, this is how you'd build your subselect query

select sms_r_system.resourceid, sms_r_system.name
from sms_r_system
where resourceid not in
(
select sys.resourceid
from sms_cm_res_coll_[collid] AS coll, sms_r_system as sys
where sys.resourceid = coll.resourceid
)

In effect, this would be the same as building a collection that's limited to another collection. the only difference is that when you're using limiting collections, you can't specify to retrieve where a machine doesn't exist in a certain collection.