Friday, 11 November 2016

WSUS Cleanup Using SQL Script

Whenever we do a cleanup on WSUS we always get the below error.

Every update on WSUS (even if they are unapproved) get their metadata sent to clients unless the updates are marked as expired

WSUS does not clean unneeded (obsolete? superseded? unapproved?) updates itself. we had been running it as a "fire and forget" server: allow it to auto approve security updates and then leaving it alone. This fills the database with a bunch of updates that gets sent out

WSUS has a Cleanup Wizard which is supposed to expire obsolete and unneeded updates. We tried running this, but it would get stuck and hang forever


There is lots of advice about how to fix this problem: defragging hard drives, running the Cleanup Wizard multiple times, running weird PowerShell scripts that launch the Wizard via the command line. Most of the time noting will work 


Finally we found the below script which will help to do the cleanup through SQL

  1. ·         We can’t access WSUS database through remote SQL Management Studio, so we have to install SQL Management Studio locally.
  2. ·         To connect SUSDB - \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query For Server 2012 \\.\pipe\MICROSOFT##WID\tsql\query.
  3. ·         Make a New Query

Run the below query to check the status
exec spGetObsoleteUpdatesToCleanup

Again execute the below query to clean up the unapproved, superseded and obsolete updates.

DECLARE @var1 INT
                                DECLARE @msg nvarchar(100)
                                 CREATE TABLE #results (Col1 INT)
                                INSERT INTO #results(Col1) EXEC spGetObsoleteUpdatesToCleanup
                                 DECLARE WC Cursor
                                FOR
                                SELECT Col1 FROM #results
                                OPEN WC
                                FETCH NEXT FROM WC
                                INTO @var1
                                WHILE (@@FETCH_STATUS > -1)
                                BEGIN SET @msg = 'Deleting ' + CONVERT(varchar(10), @var1)
                                RAISERROR(@msg,0,1) WITH NOWAIT EXEC spDeleteUpdate @localUpdateID=@var1
                                FETCH NEXT FROM WC INTO @var1 END
                                CLOSE WC
                                DEALLOCATE WC
DROP TABLE #results

Now check if you see any update using this query - exec spGetObsoleteUpdatesToCleanup

Finally, run the WSUS cleanup wizard now, you will not get any errors now.

Thursday, 3 November 2016

Task Sequence - Restart Option - Error (0x00000032)


In SCCM image deployment if you get the below error during software/application installation, it could be a problem with restart step in task sequence




To confirm this you have to check the deployment log and you will be getting the below error after the restart step,

The operating system reported error 50: The request is not supported

If you check the restart properties in the task sequence the important thing to note here is that the Reboot must be set to restart "The currently installed default operating system" otherwise it will try and run the TS boot image again which obviously won't really like trying to install drivers/software/applications. In short, be sure any reboot which forms part of the Task Sequence has the below option selected,


SCCM Console Object Edit Error (Cannot edit the object which is used by...)



Sometimes when you try to edit any objects in 2012 Console, you probably get the below error, 

his because the ConfigMgr console was crashing while editing the object.




We have to run the following query in SQL to free the objects again

 select * from SEDO_LockState where LockStateID <> 0
(where SEDO stands for Serialized Editing of Data Objects)

Collect the Lock ID from the above query result and delete it with the below query,

DELETE from SEDO_LockState where LockID = ‘<LockID of the record identified in the previous query>’

Once the record is removed, We should be able to modify the object again. Hope it helps!

Friday, 16 September 2016

SCCM Secondary Site SQL Replication Issue (DRS Issue)


When you see the SQL replication has been failed and try to run replication link analyzer and you get there is an DRS issue with database, try these steps,

Below command will help you to view all SQL replication status
EXEC spDiagDRS – Running this command in SQL Management Studio will show all filed of SQL Replication

If you see the the replication group is disable ot inactive follow the below steps,


  • Run this command to remove To service entry from SSB_Dialogpool “delete from SSB_DialogPool where ToService like '%PRIMARYSITECODE'
  • On the Secondary Site create the below two files under C:\Program Files\Microsoft Configuration Manager\inboxes\rcm.box

  1. Secondary_Site_Replication_Configuration.pub
  2. Secondary Site Data.pub


  • Now run EXEC spDiagDRS command again and check if all replications are active


Wednesday, 7 September 2016

Distribution Point Installation failed to install Error 0x800706BA

When you install SCCM distribution point you may get this error on distmgr.log DPConnection::ConnectWMI() – Failed to connect to servernameError 0x800706BA

This means that SCCM server is unable to connect to the WMI namespace on the target machine which is why the installation of distribution point is failing. You would also see an error which reads Failed to install DP files on the remote DP Error code=1722

Fix

Copy the smsdpprov.mof file into Distribution Point installation drive, you can find the smsdpprov.mof file under <drive:>\Program Files\Microsoft Configuration Manager\bin\X64 in your primary site server

Run the command prompt as administrator and execute the following command
mofcomp.exe smsdpprov.mof














If you still getting the same error run the below command,

netsh firewall set service remoteadmin enable

This command will allow remote user to execute / allow access the local firewall policy

Wednesday, 31 August 2016

How PXE Works


Machine Start the network boot and send the broadcast to the entire network with  option 60

Both DHCP and WDS/PXE servers gets the broadcast on port 67

DHCP Offers the free IP to the client and the client receive the IP on port 68

But before the client machine requests for the offered IP, it waits for a green signal from WDS. WDS/PXE sever runs a stored procedure, LOOKUPDEVICE for the client machine against SCCM DB. If the machine is found in the DB or If there is an advert for Unknown collection, WDS signals client to proceed with the PXE boot.

Client machine now requests for the IP offered by DHCP and DHCP then acknowledges this IP assignment. Machine finally has an IP address and is ready to proceed further. (DORA completes).

The above scenario is only true if we have the client machine PXE and DHCP all are in same subnet. If any of these 3 are in a separate subnet, necessary arrangement needs to be made so that the Broadcast sent by client could reach to both DHCP and PXE server.

In this case we configure IP helper in router so the broadcast can to forwarded to DHCP and  PXE Server.

Now the client download WDSNBP.COM from PXE server

Wdsnbp.com validates the DHCP/PXE response packet and proceeds to download PXEBoot.com

PXEBoot.com downloads Bootmgr.exe and the BCD store. The BCD store must reside in a \Boot directory in the TFTP root folder. Additionally, the BCD store must be called BCD (BootMGR and BCD store are used to initialize the WINPE environment)

Bootmgr.exe reads the BCD operating system entries and downloads Boot.sdi and the Windows PE image (Winpe.wim).

Bootmgr.exe begins booting Windows PE by calling into Winload.exe within the Windows PE image.
Point for Failure

Client Machine may not be part of SCCM DB and there is not advert on Unknown collection.        This can be tracked in SMSPXE.LOG which is available on PXE service point in MP directory.

Client machine is not in the same subnet as of the PXE and DHCP server. In this situation if the IP helper table is not configured, the broadcast sent by client will not be forwarded to the other  subnet.

Ports: 66, 67 and 4011 should be open for IP assignment and WDS file download.

Machine reboots the moment WINPE screen appears Enable command prompt in WINPE and open CMD by hitting F8 once WinPE initializes. Make sure machine has an IP address and the HDD is Setting detected. Command which you can run here is IPCONFIG and DISKPART. DISKPART will confirm the presence of storage while ipconfig will confirm network connectivity.

Collect SMSTS log to see the detailed error and troubleshoot accordingly.

Once you see the TS execution has started, we conclude PXE boot is working

Sunday, 28 August 2016

SCCM Prompt Query to find Machine Name Using MAC address

During the OSD deployment you may faced issue with known machine in SCCM database. Even thought you deleted the machine, somehow the MAC address register in SCCM database in different name.

Below is the prompt query which helps to find computer name using MAC address.

select distinct SMS_R_System.Name, SMS_R_System.MACAddresses from  SMS_R_System where SMS_R_System.MACAddresses = ##PRM:SMS_R_System.MACAddresses## order by SMS_R_System.MACAddresses

🔍SCCM (MECM) RAS Assessment

  SCCM (MECM) RAS Assessment – Comprehensive Checklist 1️⃣ Site Infrastructure & Core Health ✔ Site Server Component Status Site c...