Windows 8 and Improving Power Management (with metro apps)

FYI, here’s a handy post (from Nov 2011, but new to me today) on Windows 8 and Power Management of Metro style apps.

This works the same whether you are in front of the PC using it or leave the PC long enough for the screen saver or lock screen to kick in. Suspension of inactive apps only applies to Metro style apps, not to basic OS functions like copying files.

 

The post also talks about how running metro apps that are not currently being used can be closed to free memory.

 

Greg

 

Show Software Update Compliance State for each System in a Collection

We had an internal request to “Show me software update compliance state for each system in a collection, based on an Update List”. There are a couple canned web reports available that got me close, but not exactly what I need.  So here it is in case anyone else is interested.

Here’s a shot of the report:


Here’s the SQL:

declare @CI_ID int; select @CI_ID=CI_ID from v_ConfigurationItems where CIType_ID=9 and CI_UniqueID=@AuthListID 

SELECT rs.Name0 AS MachineName, rs.User_Name0 AS LastLoggedOnUser, asite.SMS_Assigned_Sites0 AS AssignedSite, rs.Client_Version0 AS ClientVersion, 
(CASE cs.Status WHEN 0 THEN 'Compiance State Unknown' WHEN 1 THEN 'Compliant' WHEN 2 THEN 'Non-Compliant' WHEN 3 THEN 'Conflict Detected' ELSE 'Null' END) 
AS State, cs.StatusTime 
FROM v_ClientCollectionMembers AS ccm INNER JOIN 
v_UpdateListStatus_Live AS cs ON cs.CI_ID = @CI_ID AND cs.ResourceID = ccm.ResourceID INNER JOIN 
v_R_System AS rs ON rs.ResourceID = ccm.ResourceID LEFT OUTER JOIN 
v_RA_System_SMSAssignedSites AS asite ON asite.ResourceID = ccm.ResourceID 
WHERE (ccm.CollectionID = @CollID) 
order by rs.Name0

 

Download the report

Greg

ramseyg@hotmail.com

How to: Set Sending Priority of All ConfigMgr Driver Packages with PowerShell

Here’s a quick answer to a post yesterday on myITForum’s ConfigMgr/SMS Email list.

#replace MySiteServer with central site server name,
#and LAB with site code
get-wmiobject sms_driverpackage -namespace root\sms\site_LAB -computer MySiteServer -filter "Priority <> 3" | foreach {
    $_.Priority = 3
    $_.Put()
}

Use this script to set the Sending Priority to Low for all ConfigMgr driver packages. You can see in the script, we query the SMS_DriverPackage class for all Driver packages that do not have a Priority = 3, and then enumerate each one, set the Priority property to 3 (3=Low, 2=Medium, 1=High) and then used the Put() method to save the change. Here’s a brief list of the classes that you can use modify sending priority by simply replacing the class name in the script above:

SMS_PackageBaseClass - This is the base class for all package class. Use extreme care (and testing) when running scripts against SMS_BasePackagClass.
SMS_DriverPackage
SMS_ContentPackage – new to ConfigMgr 2012, this is for Applications, no SDK Doc currently available.
SMS_OperatingSystemInstallPackage
SMS_SoftwareUpdatesPackage
SMS_TaskSequencePackage
SMS_ImagePackage
SMS_BootImagePackage
SMS_Package

You can also use the get-wmiobject –filter command to find a specific package. Just change -filter “Priority <> 3″ to –Filter “PackageID=’LAB00028′”

Bonus TIP: Here’s a quick script to show the count of each Package type using the group-object cmdlet:

#replace MySiteServer with central site server name,
#and LAB with site code
get-wmiobject sms_packagebaseclass -namespace root\sms\site_LAB -computer MySiteServer | group-object __Class | select-object Name, Count

Happy Scripting,

Greg

Win32_Product Is Evil.

This is an encore presentation from my old blog.

I’m a bit of a fan of Windows Management Instrumentation (WMI), but today’s post is a bit of a ‘buyer beware’.  I’ll sum it up, and then provide some detail and give you some ideas of where this can be a very bad thing. For starters, go to a TEST system (Windows Server 2003, Windows Vista or later), launch a PowerShell command prompt (run as administrator so that you have full rights), and run the following command:

get-wmiobject win32_product

(PowerShell is used for simplicity here – this issue occurs in every way you query Win32_Product )

Win32_Product will return some great information about each windows installer-based application.  In fact, you can even view additional properties by running get-wmiobject win32_product | select * . However, even though you called a basic query of the Win32_Product class, you actually performed a consistency check of each installation. Take a look at the Application Log after running the previous command  (event viewer), and you will see something similar to this:

EventID = 1035

Source = MsiInstaller

Details = “Windows Installer reconfigured the product…. “

Each of these entries is for a Windows Installer product, and you can see in the details that each product was ‘reconfigured’ – luckily, if you have healthy Windows Installers, everything should be happy, and the consistency check just confirms that. If however you have systems that are unhealthy, or the installation has been altered in some way, this could cause a failure during the consistency check, or a failure of the application after the reconfigure.

The bottom line is that I expect when I query a WMI namespace, that ONLY a query occurs. Unfortunately, with Win32_Product, that’s not the case.

Here’s a KB article for Vista and Server 2008 that explains a scenario with using Win32_Product as a WMI Filter in group policy – the same info applies when querying Win32_Product manually or with an enterprise systems management tool.

Event log message indicates that the Windows Installer reconfigured all installed applications

http://support.microsoft.com/kb/974524

The article only applies to Vista and Server 2008, but I can confirm that the same thing happens on Server 2008 R2 and Windows 7.

Now that we’ve talked about the general issue, let’s talk about where things can go bad with using Win32_Product in ConfigMgr.

Win32_Product Use Potential Issues
System Center Update Publisher (SCUP) Using Win32_Product in an Applicability rule will cause every system in your site (regardless of collection membership) to run the query, which causes the consistency check/repair. You can’t control this on a collection level. All clients that are configured to the Software Update Point will perform the scan. This custom update automatically replicates to all children sites with Software Update Points.  Each time a scan is run, the Windows Installer consistency check/repair will run.
Desired Configuration Management Creating a Configuration item (CI) with win32_product will cause every system that is targeted with the CI to initiate the consistency check/repair each time the baseline rule is evaluated.
SMS_DEF.MOF (hardware inventory) Untested, but I believe the consistency check/repair will occur each time hardware inventory runs for all clients in the site.
ConfigMgr 2012  App-Model Deployment Types If deploying to USERS, the consistency check/repair will occur when a user attempts to install the software from the software catalog.
If deploying to DEVICES, I the consistency check/repair will occur when the client checks to verify that software is installed.

So as you can see, in the ConfigMgr world, there are many ways to use win32_product that can cause you to have a bad day. So be careful with win32_product!

The good news is that (so far) the message reported is benign, and it doesn’t seem to actually cause a repair. If you encounter a product where this does cause a repair, please send me the info asap.

Greg

ramseyg@hotmail.com

Configuring and deploying Microsoft’s Private Cloud–Microsoft Virtual Academy

Just in case you haven’t seen it yet, check out the Microsoft Virtual Academy for a MMS warm-up.

Configuring and deploying Microsoft’s Private Cloud

During the 8 modules of this specialization, you will be introduced to all the elements of building the Microsoft private cloud. You’ll learn how to optimize and deploy the private cloud starting at the infrastructure layer. You’ll also be introduced to advanced virtualization management features and the concept and implementation of the System Center’s private cloud application service model.

Greg

Keeping Up With Microsoft Daylight Savings Time Updates

My colleague Angie and I were searching for “The Latest” Daylight Saving Time Cumulative Update and stumbled onto the following page:

http://support.microsoft.com/gp/dst_hottopics

If you deal with time zones around the world, you may want to bookmark that page for future reference! Unfortunately, Microsoft doesn’t release time zone patches as a separate category, and since they’re not a security update, are often overlooked.

Greg

Quick PowerShell Script to list all Primary and Secondary sites with Site Version

Just a quick example for listing all your sites – run this against your central site.

#replace MySiteServer with central site server name, 
#and LAB with site code
$sites = Get-Wmiobject SMS_Site -computer MySiteServer -namespace root\sms\site_LAB
#display information to the screen
$sites | select-object ServerName, SiteCode, Status, Type, Version, BuildNumber, ReportingSiteCode | sort-object ReportingSitecode
#or if you'd like, export to a .csv
$sites | select ServerName, SiteCode, Status, Type, Version, BuildNumber, ReportingSiteCode | sort ReportingSitecode | export-csv c:\temp\ConfigMgrSites.csv -notypeinformation

Greg

How To: List all servers used by your ConfigMgr Infrastructure

Here’s a quick PowerShell script to show all servers used in your ConfigMgr Hierarchy:

$myServers  = get-wmiobject  SMS_SystemResourceList `
   -namespace root\sms\site_LAB –computer LABServer
$myServers | select-object servername -unique `
   | sort Servername | out-gridview

You can alter that script a little to show all Roles for each server:

$myServers  = get-wmiobject  SMS_SystemResourceList `
    -namespace root\sms\site_LAB –computer LABServer
$myServers | select-object servername, RoleName  `
    | sort Servername | out-gridview

To run these in your environment, launch in PowerShell with proper rights to query your hierarchy, and replace “LAB” with your Central site ConfigMgr Site Code, and replace LABServer with your Central site server name.

Happy Scripting,

Greg

ramseyg@hotmail.com

Fun with WMIC

(When preparing to write this brief post, I see that my MVP colleague Sherry Kissinger also has a post on WMIC and Windows Installer. Check it out – it’s a good read too.) 

Here are a couple more examples to add to your tool belt, especially when working with teammates in remote offices, and you need information from WinPE. My perfect example is that a tech reports in that OSD isn’t working, the symptom is that no fixed disks appear to be present on the system. This error usually means that you don’t have a mass storage driver in WinPE for the hardware. Of course, this error can also mean that you have a hard disk error, or that it’s not connected to your system.

Back to task, here are two example command lines for querying win32_pnpentity to display all Plug-and-Play information for a system.

Wmic /namespace:\\ROOT\cimv2 path win32_pnpentity get /format:hform >”c:\temp\data.htm”

Wmic /namespace:\\ROOT\cimv2 path win32_pnpentity get /format:csv >”c:\temp\test.csv”

The first example writes the information to a .htm file, and the second writes the information to a .csv file.

Once you have the PNP IDs, you can begin your journey to find the appropriate mass storage drivers.

More info: Creating and editing formats in WMIC.

Greg

How to: Enable Incremental Collection Updates With PowerShell

ConfigMgr 2007 R3 shipped with a feature called Incremental Updates for collections, and ConfigMgr 2012 also supports this feature. From the official docs, here’s what incremental updates do for you:

Select this option to periodically scan for only new or changed resources from the previous collection evaluation and update the collection membership with only these resources, independently of a full collection evaluation. By default, incremental updates occur at 10 minute intervals.

This post will demonstrate how to identify collections with incremental updates enabled, as well as how to enable incremental updates for a collection.

Here’s an example to list all collections that have incremental updates enabled:

#display collections with incremental updates enabled
#replace mycfgmgrlab with site server name, LAB with Site code
gwmi sms_collection -computer mycfgmgrlab `
  -namespace root\sms\site_LAB | foreach {
  $Coll = [wmi] $_.__Path
  if ($Coll.RefreshType -eq 6) {
        write-host $Coll.CollectionID "`t" $Coll.Name
    }
}

Since RefreshType is a lazy property, you must take some extra steps. use get-wmiobject (alias is gwmi) to get all collections, then perform a for-each loop to use query the instance directly using the [wmi] accelerator for PowerShell. Finally, check to see if RefreshType = 6.

Here’s an example to enable incremental updates on a collection:


#enable incremental updates on a collection
#replace mycfgmgrlab with site server name, LAB with Site code,
#and LAB007DE with desired collecitonid
$a = [wmi] "\\mycfgmgrlab\root\sms\site_LAB:SMS_Collection.CollectionID='LAB007DE'"
$a.RefreshType = 6
$a.put()

Use the [WMI] accelerator to grab the specific instance with lazy properties, and set RefreshType = 6

Valid values for RefreshType:

  • 6 = Incremental and Periodic Updates
  • 4 = Incremental Updates Only
  • 2 = Periodic Updates only
  • 1 = Manual Update only

For more information about Incremental Updates, review’ the Microsoft page for Creating Collections in ConfigMgr 2012 (expand the node “To Create a Device Collection” to see the details.) Also note that the following classes do not support incremental updates:

  • SMS_G_System_CollectedFile
  • SMS_G_System_LastSoftwareScan
  • SMS_G_System_AppClientState
  • SMS_G_System_DCMDeploymentState
  • SMS_G_System_DCMDeploymentErrorAssetDetails
  • SMS_G_System_DCMDeploymentCompliantAssetDetails
  • SMS_G_System_DCMDeploymentNonCompliantAssetDetails
  • SMS_G_User_DCMDeploymentCompliantAssetDetails (for collections of users only)
  • SMS_G_User_DCMDeploymentNonCompliantAssetDetails (for collections of users only)
  • SMS_G_System_SoftwareUsageData
  • SMS_G_System_CI_ComplianceState
  • SMS_G_System_EndpointProtectionStatus
  • SMS_GH_System_*
  • SMS_GEH_System_*

More information about Lazy Properties:

Greg

 

[edit 6/18/2012 to add 4=Incremental Updates Only - Thanks Josef!]

Follow

Get every new post delivered to your Inbox.

Join 1,246 other followers