Showing posts with label SCCM. Show all posts
Showing posts with label SCCM. Show all posts

Wednesday, February 28, 2018

SCCM: Copy product categories from WSUS to SUP

For a project where Patch Management was migrated from WSUS to SCCM (SUP with new WSUS) i needed to create a list of product categories and sync them with the categories in SCCM.

This script retrieves a list of selected product categories from an WSUS server and searches for the corresponding category on your Software Update Point. It then will enable the subscription for this specific category.

As a precaution you have to change the scanOnly variable to actually enable this/

Before all this, the script will first create a backup of your current selected categories and export it to a timestamped CSV file.

#requirements

  • SCCM console installed
  • WSUS console installed 


Script


Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" # Import the ConfigurationManager.psd1 module 
$SiteCode = Get-PSDrive -PSProvider CMSITE
Set-Location "$($SiteCode.Name):\"

$supCatBackupPath = "C:\SCCM_SUP_Subscribed_ProductCategories_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"
$onlyScan = $true #Change this to $False if you are sure to change the Software Update Point categories.

#get current selected SUP categories
$subscribedCats = Get-CMSoftwareUpdateCategory -Fast | ? { $_.IsSubscribed -And $_.CategoryTypeName -eq "ProductFamily" -Or $_.CategoryTypeName -eq "Product" }
#backup to CSV file
$subscribedCats | Export-CSV -Path $supCatBackupPath -Delimiter ";" 

$wsusserver = "myWSUSserver"
$wsusport = 8530

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | Out-Null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($wsusserver,$False,$wsusport)
$wsusSubscription = $wsus.GetSubscription()
$selectedProducts = $wsusSubscription.GetUpdateCategories() | Select Title
$selectedProducts

$selectedProducts.Title | % { 
    $_
    $supCat = Get-CMSoftwareUpdateCategory -Fast -Name "$_"
    if($supCat.IsSubscribed -eq $False) {
        Write-Host -ForegroundColor Red "Not subscribed"
        if($onlyScan -eq $False) {
            $supCat.IsSubscribed = $true
            $supCat.Put()
        } else {
            Write-Host "scan only, not changing..."
        }
    } else {
        Write-Host "Already subscribed"
    }
}

Thursday, January 18, 2018

SCCM - Download Software Updates with PowerShell

After you setup your new SCCM environment, it can be time consuming to download all Software Updates and place them in the right deployment package. This is an example of how you could automate that with PowerShell. It will download all software updates contained in the given Software Update Group and will save and download them to an already created deployment package.
$sugDeployment = "Deployment Group - 2017 - Microsoft Updates - Non-OS"
$dpkg = "Deployment Package - 2017 - Microsoft Updates - Non-OS"
$supLanguages = @("English","Dutch")
Get-CMSoftwareUpdateGroup -Name $sugDeployment | Save-CMSoftwareUpdate -DeploymentPackageName $dpkg -Verbose -SoftwareUpdateLanguage $supLanguages
Creating a deployment package with PowerShell is also possible, but remember you need to create the path on the filesystem yourself.

Monday, December 18, 2017

SCCM: Query collection membership for specific system

Beneath you find a WQL query for listing all collection memberships for a specific system in SCCM I got some examples of the internet which didn't work for me. This query does and uses a prompt asking for a system resource name.
select COL.Name from SMS_Collection as COL
JOIN SMS_FullCollectionMembership as COLMEM on COL.CollectionID = COLMEM.CollectionID where COLMEM.Name = ##PRM:SMS_FullCollectionMembership.Name##
order by COL.Name
You can use this query within SCCM solely as a Query or as a collection membership query. For SQL queries and reports take a look here

Wednesday, September 28, 2016

SCCM: Using Cmdlets from SCCM PowerShell Module

If you want to use PowerShell with SCCM, you can do two things.
  • Load the PowerShell through the SCCM Console (left top corner: Connect via Windows PowerShell)
  • Load the PowerShell module manually
When you use the manual method, the SCCM PS drive should be loaded automatically.
import-module($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')

You can verify this with the command Get-PSDrive command
Get-PSDrive -PSProvider CMSite

When the CMSite PowerShell Drive is not available, you can create it yourself and connect to the SCCM site. The only parameter you need is the name of the Site Server which hosts the SMS Provider. This is usually the Primary Site Server.
How to add the CMSite PSDrive manually:
New-PSDrive -Name "SCCM" -PSProvider CMSite -Root "<SCCM_SERVER>"
cd SCCM:
Of course you can use whatever name you want.

More info:
http://www.hasmug.com/2016/04/25/easily-document-configmgr-client-settings-with-powershell/ (thanks for the csv function!)
http://www.verboon.info/2013/05/powershell-script-to-retrieve-sccm-2012-client-settings/
https://blogs.technet.microsoft.com/enterprisemobility/2013/03/27/powershell-connecting-to-configuration-manager/

Tuesday, May 22, 2012

Powershell: Split text file in multiple files

For importing computer entries in SCCM I had a rather big file with 35000 items in it. I wanted to take a phased approach and found a script to split the CSV file based on a number of lines per file. Script Center repository: http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Split-large-log-6f2c4da0

I tweaked the script a little bit, so only the parameters that are necessary are File Name and Number of Lines Per File.

$linecount = 0
$filenumber = 1

$sourcefilename = Read-Host "What is the full path and name of the log file to split? (e.g. D:\mylogfiles\mylog.txt) "
$destinationfolderpath = Split-Path $sourcefilename -parent

$srcfile = gci $sourcefilename
$filebasename = $srcfile.BaseName
$fileext = $srcfile.Extension

Get-Content $sourcefilename | Measure-Object | ForEach-Object { $sourcelinecount = $_.Count }

Write-Host "Your current file size is $sourcelinecount lines long"

$destinationfilesize = Read-Host "How many lines will be in each new split file? "

$maxsize = [int]$destinationfilesize
 
Write-Host File is $sourcefilename - destination is $destinationfolderpath - new file line count will be $destinationfilesize

Write-Host "Writing part: $destinationfolderpath\$filebasename`_part$filenumber$fileext"
$content = get-content $sourcefilename | % {
 #Add-Content $destinationfolderpath\$filebasename_$filenumber.txt "$_"
 Add-Content $destinationfolderpath\$filebasename`_part$filenumber$fileext "$_"
  $linecount ++
  If ($linecount -eq $maxsize) {
    $filenumber++
    $linecount = 0
    Write-Host "Writing part: $destinationfolderpath\$filebasename`_part$filenumber$fileext"
  }
}

Tuesday, August 16, 2011

SCCM: Get Drivers From Driver Packages (WQL)

I was searching for a way to list Driver Packages which contain Drivers. Why? I want to use Driver Packages without importing the drivers in SCCM.
Why? You can read about that here: http://hayesjupe.wordpress.com/sccm-osd-driver-best-practices/

I found an interesting script of Christjan which can detect differences in drivers between Driver Packages. The script contained the necessary WQL statements that I needed.

Here's the link to his script:
http://pr3m.pri.ee/blog/?p=653

Example WQL query for displaying the PackageID and Name of Driver Packages that contain drivers:

SELECT DPKG.Name,DPKG.PackageID FROM SMS_PackageToContent AS PTC

JOIN SMS_CIToContent AS CITC ON PTC.ContentUniqueID=CITC.ContentUniqueID
JOIN SMS_Driver AS DRV ON CITC.CI_ID=DRV.CI_ID
JOIN SMS_DriverPackage AS DPKG ON PTC.PackageID = DPKG.PackageID

Tuesday, August 9, 2011

SCCM: Task Sequence Import Fails with APPCRASH

Currently I'm working on automating the provisioning of SCCM environments.
One of the things that came along was exporting and importing Task Sequences between SCCM environments.
After automatically dealing with the package references I was ready to import them in the target SCCM deployment with my script.

Sadly, this didn't work. Even with the ConfigMgr Console it didn't work. As I was not presented with some kind of error, I searched the Event Viewer.

There I found multiple APPCRASH events (eventid 1000) on wmiprvse.exe.
So there had to be something in the Task Sequence export files that causes WMI to crash.

Many times WMI crashes because of bad queries or non-existing WMI classes, or ..... yep memory issues.

After (manually :'( ) comparing the two SCCM deployments, I found out I was missing the Microsoft Deployment Toolkit 2010 Task Sequence steps on the target SCCM deployment. After installing that, all issues were gone.

It would be nice though if the ConfigMgr console could present me with a simple error, stating that MDT was missing. Arghh.....

Monday, May 31, 2010

SCCM: Configuration Manager vNext Beta released!

Microsoft released the beta for ConfigMgr vNext last week!

If you want to take a tour to see what's new in the next generation of Configuration Manager, join the beta program:
MVP Jannis Alink, visited MMS2010 and blogged about some new features

There are 3 main pilars:

User centric application management - Empowering Administrators to define intent, and end users flexible access to the right application at the right time
  • Allow the administrator to think users first
  • Application management model to capture admin intent
  • End user self-service software portal
Infrastructure simplification – Simplify management infrastructure, processes and administrative overhead
  • Unified management across PCs and devices
  • New role based administration and end-user experiences
  • Automated content distribution and troubleshooting
  • Redesigned core infrastructure and improved scalability
Simplify Client Management – Daily tasks, model based configuration management and improvements over existing capabilities
  • Automated compliance remediation
  • Client health and auto remediation
  • Remote control enhancements
  • Offline servicing of OS images

SCCM: Configuration Manager R3 Beta available (Microsoft Connect)

For those, who for some reason, mist out on last months SCCM news. Since a few weeks SCCM R3 Beta has been released.
It's available through the Open Beta program. If you are a member of the Configuration Manager 2007 R3 Open Beta program you can download it at: https://connect.microsoft.com/site16 | https://connect.microsoft.com/site16/content/content.aspx?ContentID=16938

(It's an evaluation version and can only be used on previous eval versions or fresh installs, not on live SCCM R2 systems)

Want to see what's new in R3, use the link!

SCCM: Issue with Preloadpkgonsite.exe (SCCM Toolkit v2)

In my last blog post I described a list of new functionality coming with the new SCCM Toolkit v2.
John Marcum wrote a blog about using the tool 'Preloadpkgonsite.exe', updated in Toolkit v2.

Using this tool can cause some distribution problems between the source and stored package. If you didn't specify '/UpdateStoredPkgVersion' on the cmdline, then it's possible the stored package version and the source package version are not the same.

Read more on: http://myitforum.com/cs2/blogs/jmarcum/archive/2010/05/19/146968.aspx

Tuesday, May 4, 2010

SCCM: New ConfigMgr 2007 Toolkit (v2) available

Last week Microsoft released a new version of the SCCM toolkit. It's been a while since the last release in 2007, but there are some nice tools added to the toolkit. They aren't completely new as they were available earlier with the SMS 2003 Toolkit and updated for this toolkit.
The release also includes an updated Security Configuration Wizard Template for ConfigMgr 2007 SP2 and Windows Server 2008 R2.


Pack Contents:

Client Spy - A tool that helps you troubleshoot issues related to software distribution, inventory, and software metering on Configuration Manager 2007 clients.

Delete Group Class Tool - A tool used to remove inventory group definitions along with history data, tables, views and stored procedures for the group.

New in 2007: In addition to removing the entries in the GroupMap and AtttributeMap tables, Delete Group Class Tool also removes the inventory stored procedures, schema views and tables.

Desired Configuration Management Migration Tool - A tool used to migrate from the DCM Solution for SMS 2003 to DCM in ConfigMgr 2007.

Desired Configuration Management Model Verification Tool - A tool used by desired configuration management content administrators for the validation and testing of configuration items and baselines authored externally from the Configuration Manager console.

Desired Configuration Management Substitution Variable Tool - A tool used by desired configuration management content administrators for authoring desired configuration management configuration items that use chained setting and object discovery.

Management Point Troubleshooter Tool - A tool that checks a computer system before and after a management point installation to ensure that the installation meets the requirements for management points.

New in 2007: MP Troublshooter Tool can detect WebDAV rules and will provide simple automatic fix, which will help admin to correct issues like WebDAV authoring rules. Also supports Native Mode.

Policy Spy - A policy viewer that helps you review and troubleshoot the policy system on Configuration Manager 2007 clients.

Preload Package Tool - A tool used to manually install compressed copies of package source files on Configuration Manager 2007 sites.

New in 2007: Preload Package Tool now supports compressing packages before transferring them across the network. Supported Packages: Software Distribution Package, Virtual Application Package, Boot Image, Operating System Image, Operating System Install Package and Driver Package.

Security Configuration Wizard Template for Configuration Manager 2007 - The Security Configuration Wizard (SCW) is an attack-surface reduction tool for the Microsoft Windows Server 2008 R2 operating system. Security Configuration Wizard determines the minimum functionality required for a server's role or roles, and disables functionality that is not required. The Configuration Manager 2007 Service Pack 2 Security Configuration Wizard template supports new site system definitions and enables the required services and ports.

Send Schedule Tool - A tool used to trigger a schedule on a Client or trigger the evaluation of a specified DCM Baseline. You can trigger a schedule either locally or remotely.

New in 2007: Send Schedule Tool can now trigger DCM Baseline evaluation.
The former VBS file has become a executable.

Trace32 - A log viewer that provides a way to easily view and monitor log files created and updated by Configuration Manager 2007 clients and servers.
I haven't noticed a difference yet between the previous version and this 'new' version, besides an increased version number ;)

More info: http://scug.be/blogs/sccm/archive/2010/04/30/configmgr-2007-toolkit-version-2-is-now-available.aspx

Download: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=5a47b972-95d2-46b1-ab14-5d0cbce54eb8
(Link on SCCM Technet site is dead :) http://technet.microsoft.com/en-us/systemcenter/cm/bb892848.aspx)

Tuesday, September 22, 2009

SCCM: SCCM R3 announced

Recently Microsoft announced a new release of System Center Configuration Manager. In this release, R3, the focus is on power management.
Nowadays more and more companies look for solutions to take on power usage of there IT infrastructure. In SCCM R3 there are going to be several functionalities that can help your business to lower power consumption.



Power Management


The goal of this capability is to enable Configuration Manager to further reduce the operational costs of IT by providing basic power management features native to the product. Our approach is based on 3 primary areas:

A. Help the organization plan a power strategy by monitoring current power state and consumption and reporting on machine utilization trends, current power settings and current energy consumption

B. Enable the Administrator to easily create, deploy and enforce specific power settings using the existing ConfigMgr infrastructure.
−Ability to set peak and non-peak schedules
−Ability to remediate settings if changed
−Ability to opt out machines from power policy

C. Provide the business meaningful report formats that are relevant to Power Management

Microsoft is still looking for TAP nominees. If you want to participate, fill in their survey before October 1st, 2009. SCCM R3 TAP Survey

For more information, see the Microsoft System Center website.

Wednesday, April 22, 2009

Preparing your SCOM and SCCM exam

4 Weeks ago i sat for the offical Microsoft exams SCOM and SCCM. If you want to know more about SCOM & SCCM including passing the exams you want to read this post.


You'll probably know that there are two ways of passing Microsoft exams.

  • Get the exam questions and answers in your head, pass, know nothing and get reveiled occasionally when a client askes an in-depth question.

or, better,

  • Get a book, do the Virtual Labs from Microsoft, setup your own test environment, practice lab questions and actually know what your doing. Practice some exams and then pass the actual exam.

Important topic areas

SCOM

  • Know how to configure and maintain SCOM
  • Configuring Management packs including MOM 2005 MP's
  • New features in R2

SCCM

  • Know about the new features compared to SMS 2003, because a lot has been added to Systems Management from MS!
  • Deployments in different test environments (desktops, offsite notebooks, OSD-deployments) with service windows and baselines.

Materials

Here's a list of the best materials for studying for SCOM exam 70-400 and SCCM exam 70-401.

SCOM

Book: System Center Operations Manager 2007 Unleashed link

I really like the unleashed books. For MOM 2005 I also used the unleased book. Very complete and explained in depth.

Virtual Labs: http://technet.microsoft.com/en-us/virtuallabs/bb499680.aspx

Microsoft info (including practice tests): http://www.microsoft.com/learning/en/us/exams/70-400.mspx

SCCM

Book: System Center Configuration Manager 2007 Unleashed link

Yes, another Unleashed! For SMS 2003 I read a Microsoft Press book. It was OK, but this book for SCCM gives just more in-depth information.

(If you're familiar with other good SCCM books of which you think should be listed here, let me know)

Virtual Labs: http://technet.microsoft.com/en-us/virtuallabs/bb499680.aspx

Or http://technet.microsoft.com/en-us/virtuallabs/bb539977.aspx

Microsoft info (including practice tests): http://www.microsoft.com/learning/en/us/exams/70-401.mspx

Studying

Do theory and practices. Write down things you don't understand. Search the internet for blogs like this one for possible answers. But this is just basically what you always should do when studying techninal areas.

.... oh.... I passed both exams. :)