Wednesday, 4 December 2019

SCCM OSD - Set Time Zone Using tzutil.exe


SCCM OSD - Set Time Zone Using tzutil.exe

If you are using SCCM for your operating system deployments across different countries, then you may want to set the time zone within the task sequence.

To do this, you can take advantage of the built in Windows tool call tzutil.exe






Powershel script



powershell.exe -ExecutionPolicy Unrestricted -Command "tzutil.exe /s 'Eastern Standard Time



Create as a package with batch file

@echo off

REM Sets time zone for Central Australia Standard Time

TZUTIL.EXE /s "Cen. Australia Standard Time"

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

Thursday, 3 October 2019

SCCM - SQL Query_Update Deployment Status using AssignmentID

SCCM - SQL Query_Update Deployment Status using AssignmentID

select

vrs.name0 as machineName,

vrs.AD_site_Name0 as ADSiteName,

vrs.User_Name0 as UserName,

a.Assignment_UniqueID as DeploymentID,

a.AssignmentName as DeploymentName,

sn.StateName as LastEnforcementState,

assc.StateTime asStatusTime,

assc.LastErrorCode as LastErrorCode

from v_CIAssignment a

join v_AssignmentState_Combined assc on a.AssignmentID=assc.AssignmentID

join v_StateNames sn on assc.Statetype = sn.TopicType and sn.StateID=isnull(assc.StateID,0)

join v_R_System vrs on vrs.ResourceID=assc.ResourceID

where a.AssignmentID in (xxxxxxxx)


order by DeploymentName

Monday, 30 September 2019

Sysprep Error : Unable to sysprep the machine, hr=80004005

Sysprep Error : Unable to sysprep the machine, hr=80004005

Sysprep may fail without remove the below app without do SCCM capture

Powershell script to remove app

Command to list all available windows 10 apps

Get-AppxProvisionedPackage -Online | Select-Object PackageName

Command to remove the app

Remove-AppxProvisionedPackage -Online -PackageName <package name>

get-appxpackage *getstarted* | remove-appxpackage
get-appxpackage *photoshop* | remove-appxpackage
get-appxpackage *freshpaint* | remove-appxpackage
get-appxpackage *remotedesktop* | remove-appxpackage
get-appxpackage *skype* | remove-appxpackage
get-appxpackage *oneconnect* | remove-appxpackage
get-appxpackage *maps* | remove-appxpackage
get-appxpackage *eclipse* | remove-appxpackage
get-appxpackage *actipro* | remove-appxpackage
get-appxpackage *duolingo* | remove-appxpackage
get-appxpackage *bing* | remove-appxpackage
get-appxpackage *networkspeedtest* | remove-appxpackage
get-appxpackage *sway* | remove-appxpackage
get-appxpackage *autodesk* | remove-appxpackage
get-appxpackage *dolby* | remove-appxpackage
get-appxpackage *disney* | remove-appxpackage
get-appxpackage *candy* | remove-appxpackage
get-appxpackage *hiddencity* | remove-appxpackage

get-appxpackage *bubble* | remove-appxpackage

🔍SCCM (MECM) RAS Assessment

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