Dec 20, 2016

SCCM 2012 How to clean the ccmcache

By default Configuration Manager 2012 client stores deployed packages in %windir%ccmcache folder and default disk space for cache folder is 5120 MB.
All deployed packages and also software updates will be keep in these default folder unless you specify custom location with installation options.
Regarding TechNet article please note that:
  • Do not encrypt cache folder. Configuration Manager cannot download content to an encrypted folder.
  • For the required programs, client does not automatically retry to download the content. You must redeploy the package.
  • For the required applications, client automatically retries to download the content when it next downloads its client policy.
One of the main concern about client cache is auto-empty mechanism. There are several scripts around the web that deletes client cache but be aware that client will not be notified so will try to use cached content if installation is not succeed yet.
If you configure the package properties with the option to persist content in the client cache, client does not automatically delete package content from cache.
Likewise you can specify following properties to configure caching options on clients:
  • DISABLECACHEOPT – If set TRUE, disables the ability of end users to change the client cache folder settings using Configuration Manager in Control Panel.
  • SMSCACHEDIR – Specifies the location of the client cache folder.
  • SMSCACHESIZE – Specifies the size of client cache folder in megabyte.
Please note that if you use SMSCACHESIZE option and the package would cause the folder to exceed the maximum size, package download fails.

May 7, 2016

PowerShell script SCCM 2012 Agent Install - remotely

$CM12MP='MP.contoso.com'
$CMSiteCode='SR1'
$ErrorActionPreference = "SilentlyContinue"
try
{
#Get ccm cache path for later cleanup...
    try
    {
        $ccmcache = ([wmi]"ROOT\ccm\SoftMgmtAgent:CacheConfig.ConfigKey='Cache'").Location
    } catch {}
#download ccmsetup.exe from MP
    $webclient = New-Object System.Net.WebClient
    $url = "http://$($CM12MP)/CCM_Client/ccmsetup.exe"
    $file = "c:\windows\temp\ccmsetup.exe"
    $webclient.DownloadFile($url,$file) 


Restart Computers Remotely via PowerShell

To restart a remote computer, you need to run the command with credentials that have the right privileges to remotely shut down a computer, typically an admin account. Assuming my current credentials were adequate, I could easily reboot the computer SERVER01:
PS C:\> Restart-Computer Server01 -whatif
What if: Performing operation "Restart-Computer" on Target " (Server01)".
although I didn't really; I took advantage of the -WhatIf parameter to verify my command. This is especially helpful if I'm rebooting a bunch of servers:
PS C:\> restart-computer "server01","server02","server03" -whatif
By the way, here's how you could shut down a list of computers:
PS C:\> restart-computer (get-content c:\work\computers.txt)
Because the cmdlet is using WMI objects and methods under the hood you can specify alternate credentials, either a saved credential object or a user name:
PS C:\> restart-computer (get-content c:\work\computers.txt) -credential "mycompany\administrator"
I'll get prompted for the password, but then this credential will be used for every computer in the list.
The Restart-Computer cmdlet will fail, if a logon session is detected. PowerShell will raise an exception. However, you can force a reboot using -- what else? -- the -force parameter. Be aware this will force applications to close with the potential loss of unsaved work.
Another option for rebooting or even logging off is to use the Win32_OperatingSystem WMI Class and the Win32ShutDown method. I recommend using Invoke-WMIMethod because it supports -WhatIf and -Confirm. I found it just as easy to pipe a WMI object from Get-WMIObject to Invoke-WMIMethod:
PS C:\> Get-WmiObject win32_operatingsystem -ComputerName Quark | Invoke-WMIMethod -name Win32Shutdown
The Win32Shutdown method can accept parameters. The default is 0 which means do a simple logoff. But if the user has open files or if the default method fails, you can always resort to a forceful logoff:
PS C:\> Get-WmiObject win32_operatingsystem -ComputerName Quark | Invoke-WMIMethod -name Win32Shutdown -ArgumentList @(4)

May 6, 2016

Microsoft System Center Operations Manager 2012 Setup and Config

WSUS full guide

SCCM 2012 SP1 Full Installation Step By Step (Remote SQL Method)

SCCM Client Trigger Schedules

The trigger schedule references below are used by the SCCM 2012 Client.

{00000000-0000-0000-0000-000000000001} Hardware Inventory
{00000000-0000-0000-0000-000000000002} Software Inventory
{00000000-0000-0000-0000-000000000003} Discovery Inventory
{00000000-0000-0000-0000-000000000010} File Collection
{00000000-0000-0000-0000-000000000011} IDMIF Collection
{00000000-0000-0000-0000-000000000012} Client Machine Authentication
{00000000-0000-0000-0000-000000000021} Request Machine Assignments
{00000000-0000-0000-0000-000000000022} Evaluate Machine Policies
{00000000-0000-0000-0000-000000000023} Refresh Default MP Task
{00000000-0000-0000-0000-000000000024} LS (Location Service) Refresh Locations Task
{00000000-0000-0000-0000-000000000025} LS (Location Service) Timeout Refresh Task