Client Health: Repair the WMI Path and ensure WMI is added

Once upon a time I wrote a Client Health repair script for Windows XP SMS and SCCM 2007 environments.  By far and away the biggest issue was WMI corruption.  The point of this script was to fix as much as humanly possible WITHOUT using WMI.  No minor feat and you can see one section below here.   A major issue that was EASILY remedied was ensuring WMI was in the system path.  This was recently pointed out to me that people were charging for simple logic.  So here is a nice way to do it for free with a few more frills thrown in for free.

Solution: Fix the WMI in the System Path

The fix below will parse you entire system path and remove any %variable%, remove duplicates, and ensure certain items are in the System path like WMI.  I always wanted to add in a check to look for UNC (\\) paths as those always make a system go slower.

The following script will NOT work.  Please see the full CLIFIX script

CLIFIX_Public_V4_18

Dim windir: windir = WSHShell.ExpandEnvironmentStrings("%WINDIR%")



' =============================================================================
' Method: CHK_SYSTEMPATH
' Description: checks that wbem is near the front of the sys path and cleans
' any duplicate statements from the path environment
' =============================================================================

Sub CHK_SYSTEMPATH()

 WindirPath = LCase(windir)
 System32path = LCase(windir & "\system32")
 WBEMpath = LCase(windir & "\system32\wbem")

 WindirPathFound = False
 System32pathFound = False
 WBEMpathFound = False
 SystemRoot = False

 strKeyNamePath = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
 strValueName = "Path"

'// GET PATH STATEMENT
 strValue = wshshell.regRead("HKLM\" & strKeyNamePath & "\" & strValueName)
 strValue = LCase(strValue)
 
 ARRpath = Split(LCase(strValue), ";")

 For i = 0 To UBound(ARRpath)
  'Repalce SystemRoot with actual value
  If InStr(ARRpath(i), LCase("%systemroot%")) <> 0 Then strValue = Replace(strValue, LCase("%systemroot%"), LCase(windir)) : SystemRoot = True : COLLECTMSG "CHK_SYSTEMPATH","Warning Replaced %systemroot%",SystemRoot
  If ARRpath(i) = WindirPath Then WindirPathFound = True
  If ARRpath(i) = System32path Then System32pathFound = True
  If ARRpath(i) = WBEMpath Then WBEMpathFound = True
 Next

If (WBEMpathFound = True) And (System32pathFound = True) And (WindirPathFound = True) And (SystemRoot = False) Then COLLECTMSG "CHK_SYSTEMPATH","All Paths Found",WBEMpathFound: Exit Sub

 COLLECTMSG "CHK_SYSTEMPATH","PATH",strValue
 '// Log the results
 logit=False
 If WBEMpathFound = False Then strValue = WBEMpath & ";" & strValue : COLLECTMSG "CHK_SYSTEMPATH","Error WBEMpathFound", WBEMpathFound:logit=True : CLIENTSTATE = CLIENTSTATE + 1
 If WindirPathFound = False Then strValue = WindirPath & ";" & strValue : COLLECTMSG "CHK_SYSTEMPATH","Error WindirPathFound", WindirPathFound :logit=True : CLIENTSTATE = CLIENTSTATE + 1
 If System32pathFound = False Then strValue = System32path & ";" & strValue : COLLECTMSG "CHK_SYSTEMPATH","Error System32pathFound",System32pathFound:logit=True : CLIENTSTATE = CLIENTSTATE + 1
 
 If logit = True Then StrERRType = StrERRType & "SYSTEMPATH_"

 '//Take out duplicates
 'Dictionary Object is Much faster
 ARRpath = Split(LCase(strValue), ";")
 Set PureString = CreateObject("Scripting.Dictionary")
 For i = 0 To UBound(ARRpath)
  If Not PureString.Exists(ARRpath(i)) Then PureString.Add ARRpath(i), ARRpath(i) : Debug(ARRpath(i))
 Next
 strValues = ""
 For Each strKeyName in PureString.Keys
  strValues = strValues & strKeyName & ";"
 Next
 Set PureString = Nothing
 'Remove duplicate semicolons
 If InStr(strValues, ";;") <> 0 Then strValues = Replace(Replace(strValues, ";;", ";"), ";;", ";")
 'Remove trailing semicolons
 ln = Len(strValues)
 If InStr(ln, strValues, ";") <> 0 Then strValues = Left(strValues, ln - 1)
 '// Set PATH STATEMENT
 'Set to current runtime path
 Set oEnv = WshShell.Environment("System")
 oEnv("Path")=strValues
 Set oEnv = Nothing
 'Set to Registry for next restart
 wshshell.regwrite "HKLM\" & strKeyNamePath & "\" & strValueName,strValues,"REG_SZ" 
 RegCounter "CHK_SYSTEMPATH",1
 COLLECTMSG "CHK_SYSTEMPATH","PATH_CLEAN", strValues
End Sub

WI 15048: SCCM Control Panel Applet missing – Command line to run it

With the improvements to the control panel the Configuration Manager Control Panel Applet (CPL) has disappeared.  To add insult to injury the default location of the SCCM client is not indexed nor in the system path.

Open the Configuration Manager CPL

c:\windows\ccm\SMSCFGRC.cpl

SMS back from the dead 🙂  I always wondered if the files were not renamed due to all the white and black listing applications that would have to be updated… or if it is just because that is how they were checked into the coding suite.

 

Best

Client Health : Group Policy initiated Based Script – All those core fixes still work great with SCCM Current Branch for FREE!

It came to my attention recently in a Twitter Post by Troy Martin that client health is still a thing.  It is silly companies are trying to take your money to fix clients for SCCM by doing things that have been free since 2005 and which SCCM CB fixes really well. Here is a table from the twitter post that is pretty good

c6em6iiuwaa7jkb

To add to the detail of the things you can get from the community.  Here is my updated post from MyITForum in 2008.  I picked up the torch in 2006 and ended in 2010.  Lots of great fixes out there that still work!  Just like the Sunshine and Daises.  Client Health is really easy now and free!

I am ACTIVELY looking for a copy of the script Public_SMS_CLIFIX_V4.21.vbs.txt was the last one I released.  All thanks to @Mike Terrill (www.miketerrill.net) for dredging up 4.18

CLIFIX_Public_V4_18

Below is a listing of features in a reworked version of Dudeworks (Thanks Rob and Brian), 1E, et al. (see bottom for longer list) start up scripts.  I recently became aware of Chris Stauffers Client Health Checker v1.2.   My script focuses on workstation health, Chris’ focuses on SMS health.  It is my hope in 2009 to combine these two if it seems intelligent to do.  Hopefully we can have this all together in early 2009.  Be great to present and then for everyone to tear apart at MMS… anything is possible. 

Reminder: this is not finalized.  It takes a community. Please feel free to post updates in the forums.

Overview

Workstation Client Health maintenance is a continuous process that must be maintained.

Overview

Workstation Client Health maintenance is a continuous process that must be maintained. The following document gives an overview on how to fix several common workstation issues.

Note: The original Link no longer works.  I am actively looking for any version 4.18.  CLIFIX_Public_V4_18

CliFix GPO startup script :- Can NO LONGER be downloaded from here http://myitforum.com/cs2/blogs/scassells/Public_SMS_CLIFIX_4.19.vbs.txt

In an effort to reduce the amount of common workstation issues I have developed a script to check and change the following common issues. This script is to be run via GPO startup scripts. This requires the script to work as the system account and have intranet connectivity. Both are accomplished by running as a GPO. Script Requirements

  1. Script must be in a location where the computers system account has access. Usually on your domain controller ex. \\FQDNDomain\sysvol\ FQDNDomain\
  2. sc.exe must be present for full successful run.
    1. Either in the run path
    2. system32
    3. system32\DLLCache
    4. Note: there are multiple versions floating around in the average environment
  3. regsvr32.exe needs to be present
  4. %systemroot%\system32 needs to be in system path
Script Settings

All, unless I missed some, sections of the script can be turned on and off in the top of the script. Please review the script as some features will fail without modification.

Please Review the following CONFIG SETTINGS Variables:

  • SMSVersion
  • ConfigMgrVersion
  • WKS_ASSIGNSITECODE
  • WKS_CacheSize
  • WKS_LocalAdminGroup
  • WKS_admACCT
  • RegPath
  • strWebAddress
  • StrCCRServer
  • strCCRSiteCode
  • CCMSetUP
What the Script Does
  1. Checks to make sure the script has not run in X many hours.
    1. Example if X = 12 the script will not run again until at least 12 hours after the last occurrence.
    2. This will prevent a slow down on multiple reboots.
  2. Sets DCOM permissions to be correct for SMS / SCCM configuration
  3. Checks to make sure System Path has the 3 required windows paths enabled. (does NOT use WMI or require a restart to change values)
    1. C:\windows
    2. C:\windows\sysetm32
    3. C:\windows\system32\wbem
    4. Also removes %systemroot% from path replacing it with correct full path value
    5. If one of the 3 paths is missing, it will parse the full path removing duplicates and adding a,b,or c to the beginning of the path statement leaving all else unchanged.
  4. Check to see if sc.exe exists in the run from directory and if not in the system32 directory
  5. Checks to see if this script is run on a workstation or server. If a server kills the script
  6. Checks to make sure the correct local admin group is present (value is set in header of script)
  7. Checks WMI service to see if it is set to auto and running. If not executes sc.exe to start the service.
  8. Attempts to connect to WMI object
  9. If the WMI object connect fails
    1. Attempt to do a repair (if no previous status is present in the registry and approved via script switches)
    2. Attempt to do a rebuild (if ‘repair’ status is present in the registry and approved via script switches)
    3. If both the above have failed then do nothing and report major error
  10. Checks to see if Admin$ is present, if not forces existence via WMI
  11. Checks to see if msxml3.dll is registered, if not forces existence via WSH
  12. Checks to see if Qmgr.dll and qmgrprxy.dll are registered, if not forces existence via WSH
  13. Checks to see if OLEAut32.dll is registered, if not forces existence via WSH
  14. Checks to make sure the following services are set to appropriate Status and Mode
    1. RPC
    2. WMI
    3. Firewall/ICS
    4. Server Service
    5. Remote Registry
    6. BITS
    7. Windows Update Services
    8. Terminal Services
    9. Windows Installer
    10. Note: You may want to review the settings for your environment on each of these services. All of the above services are set to default and either Manual or Automatic.
  15. Check the SMS version
  16. Checks the CCMExec service
  17. If SMS is not correct version can be forced to do an install
    1. Needs Review
  18. If the all of the above test passed without issue you have a healthy workstation. The following two checks are for SMS.
    1. Check log file last update time. If the PolicyEvaluator.log file has not been modified in past 14 days do a repair of the client.
    2. Check client assignment. If no assignment set new site code based on AD boundaries in which the client is present.
      1. Note: Some people may want to disable this as it relies on AD
  19. If any fixes above had to be preformed
    1. Check the advanced client state. Which client policies have enabled.
    2. Check the cache size
    3. Send a Client Configuration Request (CCR) to have client installed
    4. Run CCMSetup from the install share on the server.

Note during this script several forms of reporting, logging, and information submitting have been preformed. The standard methods of reporting are:

  • Event log
  • Log file in the %temp% directory for the account used to run
    • GPO = C:\windows\temp
  • Reporting to a website that submits client status to a SQL table.
    • Future WebPost on how to do this

Other verbose methods include:· Two levels of command line reportingo Log to Command lineo Verbose to command line· network share copy

Future Additions:

Area’s that need improvement

References:

·         MyITForum Forum: http://www.myitforum.com/forums/tm.asp?m=107044 ·         1E: http://www.1e.com ·         Chris Stauffers soon to be reviewed: http://myitforum.com/cs2/blogs/cstauffer/archive/2008/06/13/client-health-check-script-and-scheduled-task-version-1-1-release.aspx ·         Brian Mason: Original Author of CliFix ·         Rob Olson: Original Author of CliFix at http://www.dudeworks.com ·         Greg Ramsey:http://myitforum.com/cs2/blogs/gramsey/ ·         Steve Pruitt: http://myitforum.com/cs2/blogs/spruitt/ ·         And the MSSMS list http://www.myitforum.com

 

Windows 10 – Dell Apoint.exe – Alps_SetMouseMonitorError!!

Brand new install of Windows 10 on a dell laptop I get the error

075839ql4q22w1qjiml32j

Dell Apoint.exe

Alps_SetMouseMonitorError!!

ALPS / Apoint popup – bad dell touch pad driver

Fix

Unistall it.  You don’t need it. A new one will install later automatically via Windows Update

"C:\Program Files\DellTPad\Uninstap.exe" SILENT

ConfigMgr SCCM 2007 – How to stop advertisements with immediate effect or How to stop an errant advertisement in SMS 2003 SCCM 2007

My Cached Google fu is decently strong!  Cached source: https://www.anoopcnair.com/2011/06/04/configmgr-sccm-2007-how-to-stop-advertisements-with-immediate-effect/

The original from 2008 is Below.  I will be writing a new version shortly with SCCM CB solution.  Really nice stuff that the MS team introduced.

In real time scenario, I have faced several instances of those we need to stop the advertisement with immediate effect to decrease impact to the client machines. Today, I have gone through a good wright up on this topic from Shaun Cassells.

Read the orginal post here

Scenario: An advertisement went out for a package that is causing havoc.  Let’s say, it is rebooting servers and workstations.   How do you stop it NOW!?!?!  With a Big Red Stop Button (BRSB).

Below are 5 scenarios with varying speeds and success rates.

Method 1: Stop the IIS service or the SMS_OFFER_MANAGER service on all servers.

Upside: Everything stops

Downside: Everything stops including normal client communications or any other distribution

Method 2: Delete the source package files off the DP(s) update: change the ntfs folder premissions to deny any client from reading the source files.  Thanks jnelson

Upside: All clients trying to run errant advertisement will say “Waiting For Content”

Downside: Copying the package source back to the DP after everything calms down.

Method 3: Delete the Advertisement (Do not do this)

Upside: Makes you feel better

Downside: Does not stop any clients until a policy refresh is triggered.  You also lose all tracking of the damage you have wrought.

Method 4: Disable the Program

Upside: Prevents further execution

Downside: Does not stop any clients until a policy refresh is triggered.

Method 5: Expire the advertisement

Upside: Prevents further execution

Downside: Does not stop any clients until a policy refresh is triggered.

Summary: Best solution for Big Red Stop Button (BRSB) appears to be Method 2.  Delete the files off the DP.  You will need to know the PackageID. (see reports below) and the location of the DPs (see reports below).

Best order of execution to achieve BRSB

  1. Identify PackageID
    1. See report below
    2. See console command line below
  2. Identify DPs that you will need to target
    1. See report below
  3. Run a script to delete the files off the DPs
  4. Disable the program
  5. Disable the advertisement (change the execution expiration time)
  6. View reports on advertisement success rate so you know who to go fix

If there is desire for me to post the scripts or more screen shots on how to do this, please respond to this post, and I’ll whip more docs up.

Now that the package has stopped, the clients have received new policies to prevent the errant program from executing again.  How do I get the files back on the DP?  Easy, refresh the Distribution Points from the package.  Refresh will keep the DP version the same.  Reminder: if you update the DPs.  You will be creating a new version, which may cause clients to execute this new package.  (Been there)

Helpful Reports (SMS 2003)

List of All packages:

http://<ServerNameHere>/SMSReporting_<SiteCode>/Report.asp?ReportID=137

List of All Active Package Distributions:

http://<ServerNameHere>/SMSReporting_<SiteCode>/Report.asp?ReportID=141

List of All DPs:

http://<ServerNameHere>/SMSReporting_<SiteCode>/Report.asp?ReportID=138

Location of DP (SMS 2003)

\\<ServerNameHere>\smsdp$\SMSPKG

How to add NodeInfo to the SMS 2003 console?

Add the following switch to the console command line

/SMS:NodeInfo=1 or /SMS:NodeInfo=2

Adds a property sheet that contains node information such as the GUID, WMI instance data, and the named values associated with the node to a node’s property page. You access the node information sheet by selecting the Node Information tab. Typically, you use this option when you develop or debug extension snap-ins that extend the SMS Administrator console.

This option can be set to 1 or 2. Setting NodeInfo to 1 places the Node Information sheet last on the property page. Setting NodeInfo to 2 places the Node Information sheet first on the property page.

SMS 2003 command line:

C:\smsadmin\bin\i386\sms.msc /SMS:NodeInfo=1

SCCM 2007 commandline

“C:\Program Files\Microsoft Configuration Manager Console\AdminUI\bin\adminconsole.msc” sms:debugview=1

How to stop advertisements with immediate effect

MyITForum Missing Blogs – Big Red Stop Button (BRSB)

Hi all,

I am currently trying to dig up my article from 2008 about the different methods to stop an errant software deployment via SCCM.  If anyone has it please let me know.  Here is the original blog location – http://myitforum.com/cs2/blogs/scassells/archive/2008/05/14/how-to-stop-an-errant-advertisement-in-sms-2003-sccm-2007.aspx

The best I can find is the 2010 MMS Birds of a feather by Kim Oppalfelds – http://wmug.co.uk/wmug/b/r0b/archive/2010/03/25/mms-2010-kim-oppalfens-birds-of-a-feather-session-on-wmi

 

http://scug.be/sccm/2010/03/24/wmi-for-the-sccm-admin-techdays-belgium-2010-mms-2010-birds-of-a-feather-session/

 

Windows 10 Current Branch Upgrades – Taking up all my free space – Identify and Resolve

Summary

I found a potential bug where constant Windows Insider builds were bloating the Previous Windows Installations to over 10 gb.  This was causing other issues on my tiny storage tablet.  The newer interface of Windows 10 provides some guidance on finding the bloat.  But it was the classic tools of WinDirStat and Disk Cleanup that resolved the bloat… but not the cause.

Background

As a windows insider I am constantly getting the Fast builds (Several a week).   My primary test device is a Dell Venue 8 Pro (DV8P) 5830 with 64gb of storage (and SD card extensiability).  I am also a Plex user and do a lot of offline sync to watch videos while I fly.

Recently, I started getting randon errors and super slow resume from sleep.  Even though my Plex app is space limited I was a bit surprised. To see I had less than 1gb free.   The following is how I figured out what was going on and fixed the issue.  As I fixed my DV8P space issue I used my laptop to do screenshots.   That’s why the space in the screen caps don’t match.

How does one find what is taking up space?

Windows 10 has a new feature called storage.  Which has some nice features like showing available space for each drive.  Great but doesn’t help me find out what is taking lots of space.  Even so lets explore.   Start >> type Storage

storage-1

If we pick the primary system drive we get a screen eating display of used hard drive space categories.  45.4 GB looks excessive lets click on that

storage-2

Keep on drilling down to System & Reserved (three clicks in still don’t know anything useful)

storage-3

Huh, 20.3 gb of system files.  Rather extreme lets click Manage System Restore.  Ahh, back to legacy interface.  Picking the drive again notice that protection is only on for primary system drive.  Hmm 7.59 is not close to the 20+gb of system.  Lets keep looking

storage-4

,Many many moons ago there was a tool called Disk Clean Up.    Start >> type Disk Cleanup

storage-5

Pick your drive. Guess it won’t do the full system just specific partitions.

storage-6

Oh this is new.  Clean Up system Files.  That 20+gb system files have to live somewhere. What happens when you click this?  Be aware,  I have already cleaned up my drive… but originally there was 10.9gb of Previous Windows Installations.  When I ran the cleanup I was provided a prompt that said you will not be able to roll back to a previous version of windows.  Okay but on my 64 gb tablet i needed the space.

storage-7

An easier way?

To this day it surprises me that Windows Explorer does not have any easy method to show the size of directories.  This would allow me to easily identify issues.  One day when I am board i’ll setup a PowerBI 🙂   Until then you can use WinDirStat.

Use the following PowerShell from an elevated Command PowerShell prompt

install-package windirstat -ProviderName Chocolatey -Force -ForceBootstrap

This will allow you to see exactly what directories are taking up so much space (example from laptop)

WinDirStat Drive space.png

Wow, all drives at a glance.  Easy drill down and sorting.  This is fabulous.  I can instantly see that my temp directory is way beyond normal in size.  On my laptop it turned out I had several VM vhdx files backed up there.  Whoops 🙂