Shaun Cassells at MyITForum.com

SMS 2003 and ConfigMgr 2007, PowerShell, Scripting, Finance, Fitness and Fun

News

Locations of visitors to this page

January 2009 - Posts

SMS 2003 Client Health Startup Script v4.18

Script updated:  http://myitforum.com/cs2/blogs/scassells/archive/2009/04/14/sms-2003-client-health-startup-script-v4-19.aspx 

 

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.  The following document gives an overview on how to fix several common workstation issues. 

CliFix GPO startup script

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: 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 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

 

 

Script v4.18: REMOVED.  v4.19

http://myitforum.com/cs2/blogs/scassells/archive/2009/04/14/sms-2003-client-health-startup-script-v4-19.aspx

 

hopefully it will be up on  www.dudeworks.com soon

Random Thought: How every American can save gas.

      As I was driving to the gym at 5 am Sunday morning, stopped at a red light with a sensor and no cars in any direction… I wondered how much gas is being wasted by poorly timed traffic lights or stop signs when they should be yield signs.  Think about how much gas you must use to go from a rest position to the correct speed on the road.  A lot.

 Then in a cynical way I realized that our local government would never change to improve as they are earning money from:
  • Gas Taxes
  • Traffic Tickets
  • Small town America forcing people to stop as they are the only light in the county
  • Costs money to city

What does that leave us? 

Time for a good idea to spread, improve traffic flow, be more intelligent, and do it right not fast and easy!

Query: HINV older than 15 days

SELECT dbo.v_R_System.Name0, dbo.v_GS_WORKSTATION_STATUS.LastHWScan

FROM dbo.v_GS_WORKSTATION_STATUS

INNER JOIN

dbo.v_R_System ON dbo.v_GS_WORKSTATION_STATUS.ResourceID = dbo.v_R_System.ResourceID

where datediff(day, dbo.v_GS_WORKSTATION_STATUS.LastHWScan, getdate()) > 15

 

Windows 7 does Boot Recovery caused by VPC 2007 Virtual Machine Additions

How Windows 7 does Boot Recovery

 

The following is based on Windows 7 Beta Build 7000

Follow the following steps to build a Microsoft Virtual PC to cause crashes.

 
  1. Using Microsoft Virtual PC 2007 (6.0.156.0) on a Windows XP SP2 machine
  2. Build a Windows 7 VM
  3. Base it on an Vista OS
  4. Once you have built you VM go to Actions >> Install or Update Virtual Machine Additions
  5. After you complete the install it will ask you to restart
  6. When you restart you will get the following BSOD
  
  1. The machine will restart again and the default option is to run a Startup Repair
  
  1. I choose to cancel the Automatic System Restore to see what happens.
  2. Another restart, BSOD, restart
  3. Then warns you that VM Additions are not installed

 

 

    11. Root Cause Found

 Root Cause Found:A recent driver installation or upgrade may be preventing the system from starting. Repair action: System RestoreResult: Cancelled Repair action: System files integrity check and repairResult: Failed. Error code = 0x490Time taken = 1219003ms 
  1. Advanced Recovery Options
  2. Asks for Keyboard Layout
  3. Login and password
  
  1. Select System Restore
  2. Navigate to the last system restore before adding on Virtual Machine Additions
  3. System Restore Completes successfully and prompts for Restart
  4. Everything Works fine again.
 

One interesting note: There does not seem to be a specific event in the System Event Viewer.

 

This is an interesting Windows 7 repeatable crash recovery test.

 

Update: Brian Keller pointed out that the SP1 for Virtual Machine prevents this issue with the VM additions.  However, we are both curious how well the recovery will work in each of the following scenarios

  1. Machine user lacks admin rights
  2. GPO is set to disable System Check Points
  3. Enterprise administration to maintain homogenous environment
6gb SATA standard coming in Q2 of 2009

The folks behind the Serial ATA standard have been working on drafting a new, faster spec for a little while now, but it looks like things are finally starting to firm up, and SATA-IO marketing chair Conrad Maxwell now says that the new 6Gb/s standard is on track for release in the second quarter of this year.

That is twice as fast as the current spec and, according to Maxwell, it'll be backwards compatible with both the SATA-1.5Gb/s and SATA-3Gb/s specs. What's more, it's apparently also the group's intention to double the E-SATA spec to 6Gb/s as well, although no one seems to be making any promises on a date for that just yet. As a bit of a bonus, the group will apparently also be rolling out a new Power over ESATA spec (or ESATAp), which will allow 5 or 12 volts of power to be delivered via an ESATA connector

Looks like this is to exceed the USB 3.0 standard speeds.

What does that mean to me?  Looks like new storage drivers will be coming soon to a WIM near you. 

Source:http://www.pcworld.com/article/156535/ATA.html?tk=rss_news

 

Posted: Jan 07 2009, 02:00 PM by scassells | with no comments
Filed under: , ,
Software Install Review via the Add Remove Table

Software Install Review for Add Remove Table

I was reading Joe Funk’s Blog Post SMS Reports - Software Install Review.

I noticed he was using the v_GS_INSTALLED_SOFTWARE table which is included with Asset Intelligence features or ConfigMgr 2007.  For those of us who do not have access to that information or for those whose information is not populating.  I made a couple of changes so these reports can be run against the v_HS_ADD_REMOVE_PROGRAMS and v_GS_ADD_REMOVE_PROGRAMS tables

As always be aware of line wrap

Step 1 – Installdate0 Field

First thing I noticed is that in the v_GS_ADD_REMOVE_PROGRAMS table is that the values of InstallDate0 are the Wild West, from null to every format possible to convey some value.

Take a look at your own with this query:

SELECT DISTINCT InstallDate0
FROM         dbo.v_GS_ADD_REMOVE_PROGRAMS

Example output:

20071011
4/11/2008
Tue Sep 23 08:09:58 PDT 2008
20080108
20060510
2006-10-30 14:30:53
12-5-2006
1/7/2008

Step 2 – Filter out invalid dates

Used the following SQL code to only work with those with valid date times

((CASE ISDATE(INST.InstallDate0) WHEN 1 THEN CAST(INST.InstallDate0 AS DateTime) ELSE NULL END) 

Step 3 – Modify the Queries

Software Install review - Count, per application, of every install over past X days
'Currently Installed - This report contains only records for software that was installed (and remains installed) within the review period  still installed when the SMS client last checked'

Declare @days INT;
Set @days = 4;

SELECT     INST.DisplayName0 AS Product, COUNT(*) AS Count, @days AS 'Scope of software install review (days)'
FROM         dbo.v_GS_ADD_REMOVE_PROGRAMS AS INST INNER JOIN
                      dbo.v_R_System AS SYS ON SYS.ResourceID = INST.ResourceID
WHERE     ((CASE ISDATE(INST.InstallDate0) WHEN 1 THEN CAST(INST.InstallDate0 AS DateTime) ELSE NULL END) >= DATEADD(dd, - CONVERT(INT, @days),
                      CURRENT_TIMESTAMP))
GROUP BY INST.DisplayName0
ORDER BY COUNT DESC, INST.DisplayName0

'Historical - Uninstalled/Reinstalled - This report contains records of software that was installed within the review period but was since uninstalled or reinstalled'

Declare @days INT;
Set @days = 4;

SELECT     INSTHist.DisplayName0 AS Product, COUNT(*) AS Count, @days AS 'Scope of software install review (days)'
FROM         dbo.v_HS_ADD_REMOVE_PROGRAMS AS INSTHist INNER JOIN
                      dbo.v_R_System AS SYS ON SYS.ResourceID = INSTHist.ResourceID
WHERE     ((CASE ISDATE(INSTHist.InstallDate0) WHEN 1 THEN CAST(INSTHist.InstallDate0 AS DateTime) ELSE NULL END) >= DATEADD(dd, - CONVERT(INT, @days),
                      CURRENT_TIMESTAMP))
GROUP BY INSTHist.DisplayName0
ORDER BY COUNT DESC, INSTHist.DisplayName0


Next steps are to work on the values I ignored as well as values with a NULL install date.

Unique Time Lapse Art Video
I am not usually one to gush, but this is some cool art by Keith Loutit.
 
Helpless
http://vimeo.com/2482776
Metal Heart
http://vimeo.com/2317118
The North Wind Blew South
http://vimeo.com/1953467
Bathtub III
http://vimeo.com/1831024
 
 
Artist Source: http://keithloutit.com
 
Enjoy
Posted: Jan 06 2009, 09:35 AM by scassells | with no comments
Filed under: