Tuesday 26 November 2019

SCCM Client Failed to install - Error 1606 (WMI Corruption)

While install SCCM client you may receive the below error due to WMI issue

·         "File C:\Windows\ccmsetup\MicrosoftPolicyPlatformSetup.msi installation failed. Error text: ExitCode: 1603"
·         InstallFromManifest failed 0x80070643
·         "CcmSetup failed with error code 0x80070643"
Sometimes recreate WMI repository will fix the issue, If you still get the error, use the below command and try the client installation again

 Copy and paste the text into a batch file.

@echo off
sc config winmgmt start= disabled
net stop winmgmt /y
%systemdrive%
cd %windir%\system32\wbem
For /f %%s in ('dir /b *.dll') do regsvr32 /s %%s
wmiprvse /regserver
winmgmt /regserver
net start winmgmt
for /f %%s in ('dir /b *.mof *.mfl') do mofcomp %%s
exit

Monday 18 November 2019

SCCM Client Status - Specific Device Collection

SCCM Client Status - Specific Device Collection


Change the CollectionID,

select s.Name0,s.User_Domain0,
CASE Client0 WHEN '0' THEN 'No' WHEN '1' THEN 'Yes' ELSE 'Unknown' END AS [Client Status]
from v_r_system s

Join _RES_COLL_SMS00001 as coll on S.Name0=coll.name


--------------------------------------------------------------------------------------------------------------------------


select
sys.Name0 as 'Computer Name',
sys.User_Name0 as 'User Name',
summ.ClientStateDescription,
case when summ.ClientActiveStatus = 0 then 'Inactive'
when summ.ClientActiveStatus = 1 then 'Active'
end as 'ClientActiveStatus',
summ.LastActiveTime,
case when summ.IsActiveDDR = 0 then 'Inactive'
when summ.IsActiveDDR = 1 then 'Active'
end as 'IsActiveDDR',
case when summ.IsActiveHW = 0 then 'Inactive'
when summ.IsActiveHW = 1 then 'Active'
end as 'IsActiveHW',
case when summ.IsActiveSW = 0 then 'Inactive'
when summ.IsActiveSW = 1 then 'Active'
end as 'IsActiveSW',
case when summ.ISActivePolicyRequest = 0 then 'Inactive'
when summ.ISActivePolicyRequest = 1 then 'Active'
end as 'ISActivePolicyRequest',
case when summ.IsActiveStatusMessages = 0 then 'Inactive'
when summ.IsActiveStatusMessages = 1 then 'Active'
end as 'IsActiveStatusMessages',
summ.LastOnline,
summ.LastDDR,
summ.LastHW,
summ.LastSW,
summ.LastPolicyRequest,
summ.LastStatusMessage,
summ.LastHealthEvaluation,
case when LastHealthEvaluationResult = 1 then 'Not Yet Evaluated'
when LastHealthEvaluationResult = 2 then 'Not Applicable'
when LastHealthEvaluationResult = 3 then 'Evaluation Failed'
when LastHealthEvaluationResult = 4 then 'Evaluated Remediated Failed'
when LastHealthEvaluationResult = 5 then 'Not Evaluated Dependency Failed'
when LastHealthEvaluationResult = 6 then 'Evaluated Remediated Succeeded'
when LastHealthEvaluationResult = 7 then 'Evaluation Succeeded'
end as 'Last Health Evaluation Result',
case when LastEvaluationHealthy = 1 then 'Pass'
when LastEvaluationHealthy = 2 then 'Fail'
when LastEvaluationHealthy = 3 then 'Unknown'
end as 'Last Evaluation Healthy',
case when summ.ClientRemediationSuccess = 1 then 'Pass'
when summ.ClientRemediationSuccess = 2 then 'Fail'
else ''
end as 'ClientRemediationSuccess',
summ.ExpectedNextPolicyRequest
from v_CH_ClientSummary summ
inner join v_R_System sys on summ.ResourceID = sys.ResourceID
Join _RES_COLL_SMS00001 as coll on SYS.Name0=coll.name

order by sys.Name0

SQL Query - All Software Installed on Specific Device Collection

SQL Query - All Software Installed on Specific Device Collection


Change the collection ID,


SELECT distinct    dbo.v_R_System.Netbios_Name0, dbo.v_R_System.AD_Site_Name0, dbo.v_GS_ADD_REMOVE_PROGRAMS.DisplayName0, dbo.v_GS_OPERATING_SYSTEM.Caption0
FROM         dbo.v_R_System INNER JOIN
                      dbo.v_GS_ADD_REMOVE_PROGRAMS ON dbo.v_R_System.ResourceID = dbo.v_GS_ADD_REMOVE_PROGRAMS.ResourceID INNER JOIN
                      dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID = dbo.v_GS_OPERATING_SYSTEM.ResourceID

Join _RES_COLL_collectionID as coll on S.Name0=coll.name

Thursday 14 November 2019

SCCM OSD - Join OU based on Gateway IP


SCCM OSD - Join OU based on Gateway IP

Using OSD Variable "OSDDomainOUName" we can join computer to different OU based on gateway IP

Add a new step Dynamic Variables right after Apply Windows Settings
Choose Add Rule - Location, then enterprise the IP of the Gateway at that location
Next Click Add Variable, like below,


And Add Apply Network settings and in the Domain OU mention as %OSDDomainOUName% then the value will taken from the Dynamic variable which we mentioned before

Try it...this will help you to reduce the TS count

SCCM SQL Query to get Bit-locker Recovery Key

  SELECT cm.Name, ck.RecoveryKeyId, cv.VolumeGuid, cvt.TypeName AS 'Volume Type', RecoveryAndHardwareCore.DecryptString(ck...