Blog Image

Blog - Dries Willems - Freelance IT Consultant

About the blog

The main reason I use this blog, is to help myself tackling similar issues. You can see this as a very small online documentation library.
Also it is useful for others who experience the same issues.

Collection query Model

SCCM Posted on 04/25/2019 10:19:08

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model like “%Optiplex 7060%”



Dell/HP BIOS UEFI Configuration

SCCM Posted on 03/19/2019 09:44:42

Dell Command Configure 3.2.0.209:
————————————————————–
HAPIInstall.cmd:

@echo off

if defined programfiles(x86) (

call %0%\..\x86_64\HAPI\HAPIInstall.bat

) else (

call %0%\..\x86\HAPI\HAPIInstall.bat

)
————————————————————–
HAPIInstall.bat:

@echo off

Echo This file will install HAPI

%0\..\hapint64.exe -i -k C-C-T-K -p “hapint64.exe” -q

————————————————————–
cctk.cmd bootorder –activebootlist=uefi
————————————————————–
cctk.cmd –secureboot=enable
————————————————————–
————————————————————–
HP BIOS Configuration Utility 4.0.15.1:
————————————————————–
BiosConfigUtility64.exe /setvalue:”Boot Mode”,”UEFI Native (Without CSM)”
————————————————————–
BCU.cmd /setvalue:”Boot Mode”,”UEFI Hybrid (With CSM)”
————————————————————–
BCU.cmd:

@ECHO OFF

set cmdline=%*

ECHO == Seting BIOS Settings ==

REM Determine Arch

IF “%PROCESSOR_ARCHITECTURE%” == “AMD64” GOTO :X64

GOTO X86

:X64

SET BCU=”BiosConfigUtility64.exe”

GOTO RunBCU

:X86

SET BCU=”BiosConfigUtility.exe”

GOTO RunBCU

:RunBCU

ECHO –Running command %BCU% %CMDLINE%

%BCU% %CMDLINE%

EXIT /B %errorlevel%



Use Legalnoticecaption for OSD Failure message

SCCM Posted on 03/19/2019 09:32:39

Set the failure message step after Setup Windows and ConfigMgr.
Set OSD Failure Message
REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v legalnoticecaption /t REG_SZ /d “The Operating System Deployment FAILED!” /f & REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v legalnoticetext /t REG_SZ /d “Please rerun the imaging task by restarting the boot media or contact the Service Desk.” /f

Remove the failure message step before the end of the Task Sequence.
Clear OSD Failure Message
REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v legalnoticecaption /t REG_SZ /d “” /f & REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v legalnoticetext /t REG_SZ /d “” /f



Redistribute failed packages

SCCM Posted on 06/06/2018 18:30:01

# Redistribute failed packages without clicking view status -> redistribute package

$SiteCode = “P01”

$PackageState = “3”

$FailedPackages = Get-WmiObject -Namespace “Root\SMS\Site_$($SiteCode)” -Query “select * from SMS_PackageStatusDistPointsSummarizer where state = $($PackageState)”

if ($FailedPackages.Count -gt 0)

{

Write-Host “There are $($FailedPackages.Count) Failed Packages at the moment.”

}

elseif ($FailedPackages)

{

Write-Host “There is 1 Failed Package at the moment.”

}

else

{

Write-Host “There are 0 at the moment.”

}

if ($FailedPackages)

{

foreach ($FailedPackage in $FailedPackages)

{

try

{

$DistributionPointObj = Get-WmiObject -Namespace “root\SMS\Site_$($SiteCode)” -Class SMS_DistributionPoint -Filter “PackageID=’$($FailedPackage.PackageID)’ and ServerNALPath like ‘%$($FailedPackage.ServerNALPath.Substring(12,7))%'”

$DistributionPointObj.RefreshNow = $True

$result = $DistributionPointObj.Put()

Write-Host “Refreshed $($FailedPackage.PackageID) on $($FailedPackage.ServerNALPath.Substring(12,7)) – State was: $($FailedPackage.State)”

}

catch

{

Write-Host “Unable to refresh package $($FailedPackage.PackageID) on $($FailedPackage.ServerNALPath.Substring(12,7)) – State was: $($FailedPackage.State)”

write-host $Error

}

}

}

https://social.technet.microsoft.com/Forums/office/en-US/36d083ef-6310-4d64-b4a7-031ee96a9d2f/sccm-2012-powershell-redistribute-failed-packages?forum=configmanagersdk



Documenting your Task Sequences Automagically (Update – v2)

SCCM Posted on 05/03/2017 15:32:38

Open PowerShell from your sccm console as an admin so you are connected to your site server

Just export your task sequence using the following command (Get-CMTaskSequence | Where-Object {$_.Name -eq “YourTaskSequenceName”}).Sequence | Out-File “C:\Temp\YourFileName.xml”

Copy tsDocumentorv2.xsl to the same folder as your task sequence.

https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/telligent.evolution.components.attachments/01/6127/00/00/03/20/49/89/tsDocumentorv2.xsl

Open your task sequence YourFileName.xml in your favourite text editor.

Enter the following as the first line:

<?xml-stylesheet type=”text/xsl” href=”tsDocumentorv2.xsl” mce_href=”tsDocumentorv2.xsl”?>

Save your task sequence file and open it in Internet Explorer. Presto!
The XSL takes care of formatting, indents and sizing.

Disclaimer: The information on this site is provided “AS IS” with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use.

This post was contributed by Aly Shivji a consultant with Microsoft Services – U.S. East Region.

tsDocumentorv2.xsl

https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/telligent.evolution.components.attachments/01/6127/00/00/03/20/49/89/tsDocumentorv2.xsl

https://blogs.technet.microsoft.com/deploymentguys/2009/02/20/documenting-your-task-sequences-automagically-update-v2/



Clear Software Center when a task is stuck at Downloading/Installing

SCCM Posted on 02/22/2017 15:10:18

$ccmProgram = Get-WmiObject -Namespace ROOT\CCM\ClientSDK
-Class CCM_Program | Where-Object {$_.EvaluationState –eq 14}

If ($ccmProgram -ne $null)

{

$ccmExecutionRequestEx = Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent –Class
CCM_ExecutionRequestEx | Where-Object {$_.RunningState -eq
“NotifyExecution” -and $_.AdvertID -gt “” -and $_.ContentID
-eq $ccmProgram.PackageID}

If
($ccmExecutionRequestEx -ne $null)

{

$ccmExecutionRequestEx | Remove-WmiObject

Start-Process sc.exe -ArgumentList “config smstsmgr depend=
winmgmt/ccmexec” -Wait

Restart-Service -Name CcmExec -Force

}

}



Clear the cache when using 1E Nomad

SCCM Posted on 12/07/2016 21:43:31

cachecleaner -deleteall -force=3



Repair SCCM Client issues

SCCM Posted on 10/13/2016 14:27:39

Great Client repair utility

SCCM Client Tool for

1.fixing WMI issues

2. Ping issues

3. Client Health issues

4. change client cache size

5. Install / Uninstall SCCM Client

6. Repair Update Cycles …. etc

The tool is downloadable as a ZIP file that contains four files:
ClientActionsTool.hta – The tool itself.
Cmdkey.exe – command line tool for managing cached credentials. This is needed for alternate credentials feature when running the HTA on Windows XP. Cmdkey.exe is natively available starting from Windows Vista.
Wol.exe – command line tool from Gammadyne Corporation to send wake up packets to remote computers.
Config.ini – A configuration file for default settings. This file is not required to run the tool, but if it doesn’t exist, the tool may prompt for the data every time it’s run.

https://gallery.technet.microsoft.com/SCCM-Client-Utility-WMI-ec270313



Troubleshoot Management Points

SCCM Posted on 10/11/2016 10:57:26

Troubleshooting:

Invalid MP cert info; no signature

Failed to query http://… for MP location

Step 1) verify the mplist and mpcert

http://server.bla.com/sms_mp/.sms_aut?mplist

http://server.bla.com/sms_mp/.sms_aut?mpcert

if you get the cert page and mp list the mp is working

https://technet.microsoft.com/en-us/library/Bb932118.aspx?f=255&MSPPError=-2147217396



Secure Delete Files Permanently with SDelete

SCCM Posted on 02/09/2016 11:14:58

Secure Delete Files Permanently with SDelete

Contents of the Software Package:

– sdelete.exe

– sdeleteEULA.reg:

————————————————-

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Sysinternals\SDelete]

“EulaAccepted”=dword:00000001

————————————————-

Tasksequence:

Restart Computer to WinPE

– Secure Wipe C Drive

— Copy SDelete

xcopy.exe “.\*.*” “%WinDir%” /E /C /Q /H /R /Y /I

Package: SDelete

— Accept SDelete EULA

regedit.exe /S sdeleteEULA.reg

%windir%

— Format and Partition Disk

Disk number: 0

Disk Type: Standard(MBR)

Volume: Primary NTFS (Quick Format)

— 7 Pass Drive Wipe

sdelete.exe -p 7 -c -z

C:\

https://technet.microsoft.com/en-us/sysinternals/sdelete.aspx



Add Packages to WinPE

SCCM Posted on 02/02/2016 15:37:47

Dism /Mount-Image /ImageFile:”C:\Temp\prodbootv62\sources\boot.wim” /index:1 /MountDir:”C:\Temp\Mount”

## Dependencies: Install WinPE-WMI > WinPE-NetFX > WinPE-Scripting > WinPE-PowerShell

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-HTA.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-NetFX_en-us.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-StorageWMI.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets.cab”

Dism /Add-Package /Image:”C:\Temp\Mount” /PackagePath:”C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab”

Dism /Unmount-Image /MountDir:”C:\Temp\Mount” /commit

Dism /Cleanup-WIM

cd C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment

copype amd64 C:\WinPE_amd64

Makewinpemedia /iso C:\WinPE_amd64 C:\Temp\prodbootv62.iso

https://technet.microsoft.com/en-us/library/hh824926.aspx



Auto Apply Drivers or Apply Driver Package

SCCM Posted on 01/08/2016 16:12:01

Auto Apply Drivers

This action relies on Plug’n’Play (PNP) detection from within Windows PE (WinPE) to scan the hardware that is present, and send this list to the Management Point (MP). The MP replies with a list of compatible drivers that are available on local Distribution Points (DPs), and the Task Sequence downloads and installs the drivers to the C: drive where they can be used by Windows the next time it boots. This action looks for matching drivers across all Driver Packages on all DPs that are accessible in the client’s site boundaries. Without specifying any Driver Packages in the Task Sequence, all matching drivers that are not disabled and not filtered out by a category are considered, regardless of what the package is named or what the original intent of the package was.

Advantages: This action requires the least amount of administration of drivers and driver packages, PNP does most of the work.

Disadvantages: Does not work with standalone media, does not detect hardware that is not present or disabled (i.e. external/USB devices, multi-level drivers, disabled in the BIOS, wireless/Bluetooth with an off switch, etc.) and does not support mass storage drivers for operating systems prior to Windows Vista/Server 2008. You have less control over driver versions, if an SCCM admin downloads different drivers and adds them to any Driver Package and replicates the package to DPs, then any Task Sequence with the Auto Apply Drivers step will find them and possibly consider them a better match. So you could have machines imaging fine one day, and then the next day problems arise or even blue screens, without the Task Sequence ever changing.

Details: The Auto Apply Drivers step in the TS performs these steps:

WinPE performs a PNP scan (devices that are disconnected or turned off are not detected)

WinPE submits the results of the PNP scan to the MP for matching

The MP returns the locations of drivers that are applicable, not disabled, not filtered out by Categories, and accessible on DPs within the current boundaries

WinPE downloads them, and depending on the OS to be installed:

Windows XP: Installs them to the correct folders under C:\Windows

Windows Vista/7/8: Directly adds them to the image’s driver store using DISM for use during Windows (mini-)setup phase

No drivers get loaded under WinPE, but the drivers are installed for the Windows PNP to find on the next boot

——————————————————-

Apply Driver Package

This action does not rely on PNPID detection and always installs all drivers included in a Driver Package, regardless of whether they are valid for that hardware or not. The Driver Packages should be grouped together logically (i.e. by operating system and hardware model) to avoid installing unnecessary drivers on the system (not because this would cause problems, drivers that are not needed are not loaded and just consume disk space). The Task Sequence step can be targeted at specific models using a WMI query.

Advantages: Provides the most control over which drivers and which versions get installed for a particular model, allows drivers to be installed for hardware that may not be present during the Task Sequence, and works with standalone media.

Disadvantages: Requires more up front administration to get the Driver Packages grouped, requires additional disk space on the Distribution Points if the drivers apply to more than one model and need to be included in more than one Driver Package.

Details: The Apply Driver Package step in the Task Sequence performs these steps:

Tries to find the package on a DP that is accessible within the current boundaries

WinPE downloads them (even if they are not needed or not applicable), and depending on the OS to be installed:

Windows XP: Installs them to the correct folders under C:\Windows

Windows Vista/7/8: Directly adds them to the image’s driver store using DISM for use during Windows (mini-)setup phase

No drivers get loaded under WinPE, but the drivers are installed for the Windows PNP to find on the next boot. Unnecessary drivers are ignored by PNP.

Summary

Most smaller companies and test labs can use Auto Apply Drivers, and it can work fine for months or years, but at some point a new driver could start getting detected as valid for older hardware and cause issues. Larger companies with a diverse or global administration model usually prefer Apply Driver Package. Some companies might prefer a hybrid approach, where the Task Sequence runs an Auto Apply Drivers step first to get most of the required drivers, and then runs Apply Driver Package steps for each model that requires additional handling.

Notes

The Import New Driver Wizard does not actually import the driver files into the SQL database, it only creates metadata information about the drivers and stores the path to the source files. The import source files need to remain in the same path after the import wizard is complete, since they will be used to update driver packages and boot images.

After you have imported new drivers, it’s good practice to manually verify the operating systems selected as supported platforms. This is done by editing the Properties and selecting the Applicability tab. The wizard tries to assign the correct platforms based on information in the .INF files, but these files are not always correct and often needs to be corrected to match the information provided on the vendor’s website or in the readme files.

I try to avoid adding any unnecessary drivers to the Windows PE boot images. Generally I try to use the default drivers provided by Windows PE, and only add drivers for mass storage controllers and network adapters when needed, or to improve performance. Do some benchmarking from Windows PE, and make sure the disk I/O for SATA drives averages at least 40MBps for writes and 80MBps for reads. Make sure the network I/O is at least 600Mbps on Gigabit, and 70Mbps or better on Fast Ethernet.

Both of the Task Sequence driver steps can only be ran from WinPE, not under full Windows.

For Windows Vista/7/8, all driver steps need to be added during the “offlineServicing” configuration pass of setup (after the “Apply Operating System Image” step, but before the “Setup Windows and ConfigMgr” step).

On pre-Vista operating systems, any mass storage and boot critical drivers must be installed with Apply Driver Package, not Auto Apply Drivers.

Thanks to Jason Sandys for input and feedback on this info.
http://blogs.catapultsystems.com/mlist/archive/2012/10/18/auto-apply-drivers-vs-apply-driver-package-in-task-sequences/



Delegate Control Domain Join failed

SCCM Posted on 12/22/2015 15:41:44

NetpJoinDomainOnDs: Function exits with status of: 0x216d

0x216d = ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED

“Your computer could not be joined to the domain. You have exceeded the maximum number of computer accounts you are allowed to create in this domain. Contact your system administrator to have this limit reset or increased.”

By default any authenticated user can add up to 10 workstations to the domain.

After that you need the appropriate rights.

You can either get the rights delegated (recommended) or increase the default limit for authenticated users (not recommended).

https://support.microsoft.com/en-us/kb/932455



Status Message Queries: Monitor Office 365 Installation

SCCM Posted on 12/17/2015 10:51:10

Peter Monten gave me a cool query for SCCM 2012 to monitor an deployment.
It is compatible with all deployments in SCCM and so I changed it for our Office 365 – 2016 rollout.

select stat.*, ins.*, att1.*, att1.AttributeTime from SMS_StatusMessage as stat left join SMS_StatMsgInsStrings as ins on stat.RecordID = ins.RecordID left join SMS_StatMsgAttributes as att1 on stat.RecordID = att1.RecordID inner join SMS_StatMsgAttributes as att2 on stat.RecordID = att2.RecordID where att2.AttributeID = 401 and att2.AttributeValue = “XYZ20198” and stat.SiteCode = “XYZ” and att2.AttributeTime >= ##PRM:SMS_StatMsgAttributes.AttributeTime##

order by att1.AttributeTime desc



Unable to export Task Sequence with dependencies in SCCM 2012 R2 SP1

SCCM Posted on 12/15/2015 14:14:38

System.NullReferenceException

Object reference not set to an instance of an object.

Stack Trace:

at Microsoft.ConfigurationManagement.Migration.ObjectSerialization.Modeling.PrototypeImpl.TryGetPropertyValue(Object instance, String propertyName, Object& value)

at Microsoft.ConfigurationManagement.Migration.ObjectSerialization.Modeling.EntityHandle.TryGetValue[T](String propName, T& value)

at Microsoft.ConfigurationManagement.AdminConsole.MigrationAssistant.ExportPageControl.relatedWoker_DoWork(Object sender, DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Remove the checkmark “Use an unattended or Sysprep answer file…” from Apply OS step, the export goes fine.

https://social.technet.microsoft.com/Forums/en-US/00b7fc39-f639-48e1-ba07-0604b29e49b1/unable-to-export-task-sequence-with-dependencies-in-sccm-2012-r2-sp1?forum=configmanagerosd



Where is Tools ConfigMgr Service Manager Option in CM 2012 Console

SCCM Posted on 11/16/2015 11:05:15

Monitoring\Overview\System Status\Component Status

http://anoopcnair.com/2012/06/05/configmgr-sccm-2012-where-is-tools-configmgr-service-manager-in-cm12-console/



Tasksequence detect freespace on disk

SCCM Posted on 11/13/2015 13:28:53

WMI Query in Tasksequence

root\cimv2
Select * from Win32_LogicalDisk where name = “C:” and FREESPACE > 5368709120



Validating file permissions and getting driver attibutes takes a lot of CPU and time on SCCM 2012 R2 SP1 CU1

SCCM Posted on 11/10/2015 10:07:39

Good news, there is a hotfix available!

https://support.microsoft.com/en-us/kb/3084586



Activate Windows 10 on KMS

SCCM Posted on 11/04/2015 12:44:20


Because there is still no new server key available (2016).
VLSC has provided us a special Windows 10 activation key.

Windows Srv 2012R2 DataCtr/Std KMS for Windows 10

For those guys who don’t understand this.
To activate Windows Clients on KMS running Windows Server, you need the Server Key to activate your client.



Multicast: Encountered error transferring file 800705B4

SCCM Posted on 10/28/2015 15:12:17

Un-checked Allow this package to transfered via multicast at package/image properties.

Cleared SerializedMCSKey and SignedSerializedMCSKey in registry (HKLM\Software\SMS\MCS).

Unchecked enable multicast at dp properties.

Checked enable multicast at dp properties.

Checked Allow this package to transfered via multicast at package/image properties.

ConfigMgr 2012 R2 MultiCast issue smsts.log showing HRESULT=800705B4)



Remove Duplicate SSRS Folders & Solve SSRS not working issues

SCCM Posted on 10/27/2015 11:07:11

* Uninstall old SCCM Client

C:\Windows\ccmsetup\ .\ccmsetup.exe /uninstall

* Clean CCM WMI

Get-WmiObject -Namespace “root” -Query “SELECT * FROM __Namespace where name= ‘ccm'” | Remove-WmiObject

* Uninstalled Reporting Services Point Role from SCCM 2012 R2

* Ran the script by (Mike Laughlin) after editing “SiteCode” & “Server Name” to clean up OLD files leaving only the ConfigMgr_”SiteCode” folder

######################################################################################################################################

# SCCM2012SP1-RemoveDuplicateSSRSFolders.ps1

# This script will connect to SSRS on a specified server and delete all folders that end with .OLD.*

# Used for SSRS cleanup after SCCM 2012 SP1 installation

# Script must be run from an account that has access to modify the SSRS instance

# 3/22/2013 – Mike Laughlin

#

# Resources used in writing this script:

# Starting point: http://stackoverflow.com/questions/9178685/change-datasource-of-ssrs-report-with-powershell

# API Documentation: http://msdn.microsoft.com/en-us/library/ms165967%28v=sql.90%29.aspx

# Previous script: http://social.technet.microsoft.com/Forums/en-US/configmanagergeneral/thread/dc9aa3b4-cea9-4a07-87ca-2795a2dbc04e

######################################################################################################################################

# Define variables

$SiteCode = “XXX”

$serverName = “SACCESQLXXX.XXX.local”

# Set the value of $noConfirm to $True only if you don’t want to manually confirm folder deletion. Use with caution.

$noConfirm = $False

# Safeguard

If ( $SiteCode -eq “” -or $serverName -eq “” ) { Write-Host “Enter the required information for the SiteCode and serverName variables before running this script.” -ForegroundColor Red -BackgroundColor Black ; Exit }

# Connect to SSRS

# $ssrs = New-WebServiceProxy -uri http://$serverName/ReportServer/ReportService2005.asmx?WSDL -UseDefaultCredential

$ssrs = New-WebServiceProxy -uri http://sccmreportsacc.XXX.local/ReportServer_INS008/ReportService2005.asmx?WSDL -UseDefaultCredential

# Get a listing of all folders in SSRS

$reportFolders = $ssrs.ListChildren(“/”, $True)

# Find all folders containing .OLD.*

$foldersToDelete = $reportFolders | Where { $_.Name -like “ConfigMgr_” + $SiteCode + “.OLD.*”}

# Quit if no folders are found

If ( $foldersToDelete.Count -eq 0 ) { Write-Host “No folders with .OLD.* found. Quitting.” ; Exit }

# Show a listing of the folders that will be deleted

Write-Host “The following folders will be deleted from SSRS on” $serverName”:`n”

$foldersToDelete.Name

Write-Host “`nTotal number of folders to delete:” $foldersToDelete.Count “`n”

# Get confirmation before deleting if $noConfirm has not been changed

If ( $noConfirm -eq $False )

{

$userConfirmation = Read-Host “Delete these folders from” $serverName”? Enter Y or N”

If ( $userConfirmation.ToUpper() -ne “Y” ) { Write-Host “Quitting, folders have not been deleted.” ; Exit }

}

# Delete the folders

$deletedFolderCount = 0

Write-Host “Beginning to delete folders now. Please wait.”

ForEach ( $folder in $foldersToDelete ) { $ssrs.DeleteItem($folder.Path) ; $deletedFolderCount++ }

Write-Host “Folders have been deleted. Total number of deleted folders:” $deletedFolderCount

######################################################################################################################################

* Run mofcomp to add classes to wmi

PS C:\Users\XXX> mofcomp “C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof”

Microsoft (R) MOF Compiler Version 6.2.9200.16398

Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.

Parsing MOF file: C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof

MOF file has been successfully parsed

Storing data in the repository…

Done!​

* Reinstalled Reporting Services Point Role

https://social.technet.microsoft.com/Forums/en-US/f6ce1fc4-fd60-4908-a308-751b2f856211/sccm-2012-sp1-evil-folders-in-reporting-services-what-are-they-and-how-to-remove-them?forum=configmanagergeneral



Error 3: Installing Java Runtime Environment 8u65 or 8u66

SCCM Posted on 10/23/2015 19:06:43

In case you are wondering, normally I would open the EXE’s and extract the MSI’s.

But today I decided to use the EXE’s with the default commands that Oracle delivers us.

Had some problems with SCCM depencies and with little time, I used a batch file.

When using SCCM and installing it with SYSTEM credentials, the java installer decided to place the msi’s under the appdata from the install account.

Because appdata from the System account is under C:\Windows\System32, it would not do the correct copy actions.

Also it was searching for java.settings.cfg under C:\ProgramData\Oracle\Java , so we needed to place the file there before installing.

I also added some custom settings to the Java configuration.

Placing the file under APPDATA of the current user.

Detection Method:

Exist

C:\ProgramData\Oracle\Java\Settings_Java8u66_Installed.txt

Exist

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\4EA42A62D9304AC4784BF2381208660F

Exist

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\4EA42A62D9304AC4784BF2681408660F

Installing:

cmd.exe /c InstallJavaRE8U66.cmd

Batchfile InstallJavaRE8U66.cmd

——————————————————————

xcopy java.settings.cfg “%ProgramData%\Oracle\Java\”* /I /S /Y /C /R

xcopy .\jre1.8.0_66* “C:\windows\system32\config\systemprofile\AppData\LocalLow\Oracle\Java\”* /I /S /Y /C /R

xcopy .\jre1.8.0_66_x64* “C:\windows\system32\config\systemprofile\AppData\LocalLow\Oracle\Java\”* /I /S /Y /C /R

timeout.exe /T 30 /NOBREAK

jre-8u66-windows-x64.exe /s INSTALL_SILENT=1 STATIC=1 AUTO_UPDATE=0 WEB_ANALYTICS=0 REBOOT=0 NOSTARTMENU=1 SPONSORS=0 /L C:\Windows\Temp\Install_SDC_Oracle_JavaRE_1.8.0.66_01.00_EN_x64.log

jre-8u66-windows-i586.exe /s INSTALL_SILENT=1 STATIC=1 AUTO_UPDATE=0 WEB_ANALYTICS=0 REBOOT=0 NOSTARTMENU=1 SPONSORS=0 /L C:\Windows\Temp\Install_SDC_Oracle_JavaRE_1.8.0.66_01.00_EN_x86.log

type NUL > %ProgramData%\Oracle\Java\Settings_Java8u66_Installed.txt

——————————————————————

java.settings.cfg -> Place this file under C:\ProgramData\Oracle\Java

——————————————————————

AUTO_UPDATE=0

INSTALL_SILENT=1

NOSTARTMENU=1

SPONSORS=0

WEB_ANALYTICS=0

——————————————————————

deployment.properties -> Place this file under %userprofile%\appdata\locallow\Sun\Java\Deployment\deployment.properties

——————————————————————

#deployment.properties

#Fri Oct 23 18:21:40 CEST 2015

deployment.modified.timestamp=1445617300114

deployment.roaming.profile=false

deployment.security.mixcode=DISABLE

deployment.security.revocation.check=NO_CHECK

deployment.version=8

install.disable.sponsor.offers=true

deployment.browser.path=C\:\\Program Files\\Internet Explorer\\iexplore.exe

#Java Deployment jre’s

#Fri Oct 23 18:21:40 CEST 2015

deployment.javaws.jre.0.registered=true

deployment.javaws.jre.0.platform=1.8

deployment.javaws.jre.0.osname=Windows

deployment.javaws.jre.0.path=C\:\\Program Files\\Java\\jre1.8.0_66\\bin\\javaw.exe

deployment.javaws.jre.0.product=1.8.0_66

deployment.javaws.jre.0.osarch=amd64

deployment.javaws.jre.0.location=http\://java.sun.com/products/autodl/j2se

deployment.javaws.jre.0.enabled=true

deployment.javaws.jre.0.args=

——————————————————————

My blog:

http://dries.metrico.be/#post96

https://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#table_config_file_options

http://www.itninja.com/software/oracle/java-8/8-update-45

http://serverfault.com/questions/721388/java-msi-install-error-3-2147287037



Windows 10: Default File Explorer view “This PC”

SCCM Posted on 10/16/2015 07:49:46

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

LaunchTo DWORD

1 = This PC

2 = Quick access



SCCM Logs

SCCM Posted on 10/07/2015 13:54:40

https://technet.microsoft.com/en-us/library/hh427342.aspx



New installation of SCCM 2012 R2 SP1

SCCM Posted on 10/05/2015 17:31:26

Upgrading your installation: If you have a System Center 2012 R2 Configuration Manager installation, you can use the System Center 2012 Configuration Manager SP2 media to install the latest patches and automatically upgrade to System Center 2012 R2 Configuration Manager SP1.

New installation: Install System Center 2012 Configuration Manager SP2 first, and then install System Center 2012 R2 Configuration Manager SP1 at the top-tier site of your hierarchy. Both of these installation files are included on VLSC.

PS:
Don’t forget to install the latest CU1
https://support.microsoft.com/en-us/kb/3074857



Removing Built-in apps from Windows 10 WIM-File with Powershell – Version 1.1

SCCM Posted on 09/22/2015 11:19:26

Removing Built-in apps from Windows 10 WIM-File with Powershell – Version 1.1

When creating a Windows-10-Image for the Enterprise you may not want to include all of the default Windows Store Applications.

This script takes a simple list of Apps and then removes the Apps from the default install.wim.

The Script works aso for Windows 8 and Windows 8.1.

Create Temp-Directory -> Mount Windows 10 WIM-File -> Remove all Built-in apps -> Unmount WIM-File -> Remove Temp-Directory. Thats all!

Windows 10: Removing Built-in apps mit Powershell (.wim)



Cannot edit the object, which is in use by …

SCCM Posted on 09/09/2015 18:03:20

Open SQL Management Studio

select * from SEDO_LockState where LockStateID <> 0

DELETE from SEDO_LockState where LockID = ‘<LockID of the record identified in the previous query>’



Changing startup to Automatic on the SCCM Remote Control Service

SCCM Posted on 08/25/2015 14:44:52

http://ccmexec.com/2015/03/changing-startup-to-automatic-on-the-sccm-remote-control-service/



DISM: Edit Bootimage WinPe

SCCM Posted on 08/03/2015 11:34:52

Dism /mount-wim /wimfile:s:\winpe\boot_W10_x64.wim /index:1 /mountdir:s:\winpe\mount

Dism /image:s:\winpe\mount /add-driver /driver:s:\winpe\drivers /recurse

Dism /image:s:\winpe\mount /Set-InputLocale:nl-BE

Dism /image:s:\winpe\mount /Set-SysLocale:nl-BE

Dism /image:s:\winpe\mount /Set-UserLocale:nl-BE

Dism /Unmount-Wim /MountDir:s:\winpe\mount /Commit

Dism /Cleanup-WIM



Install Console

SCCM Posted on 06/18/2015 10:50:37

ConsoleSetup.exe /q TargetDir=”%ProgramFiles(x86)%\Microsoft Configuration Manager\AdminConsole\” EnableSQM=0 DefaultSiteServerName=SCCMP.CORP.ME

%ProgramFiles(x86)%\Microsoft Configuration Manager\AdminConsole\bin
Microsoft.ConfigurationManagement.exe
5.0.8239.1000



Can’t Delete ConfigMgr_OfflineImageServicing Folder After Failed Servicing

SCCM Posted on 06/09/2015 16:37:57

Take ownership on the last Folder

Give your account full control

Delete the folder

This does only work after you apply

dism /get-MountedWimInfo

dism /cleanup-wim



Reporting Services Site Role Setup: Instance Blank/Empty

SCCM Posted on 03/17/2015 10:55:29

When attempting to set up and configure the ConfigMgr 2012 site system role for reporting services, a frequently experienced “problem” is that the instance name can be blank/empty in the wizard and thereby unable to proceed with the wizard. This usually occurs when SRS has not been pre-configured properly.
While it is common “knowledge” that the reporting services database needs to be created first, an oft-overlooked step is to use the Reporting Services Configuration Manager to create the virtual directories for IIS. And it is these steps which need to be completed to get you on your way.
Open Reporting Services Configuration ManagerConnect to the server/instanceClick on Web Service URL – make a fake change, such as changing the name of the virtual directory and then putting it back to ReportServer – and clicking Apply. This will then create the new virtual directories.
Click on Report Manager URL – again, make a change to the name and put back to just Reports – and click Apply to generate the new virtual directories.Close configuration managerReturn to the CM12 site role setup program, click “Verify” for the database connection, and voila the instance is now populated correctly!

http://myitforum.com/myitforumwp/2012/10/10/reporting-services-site-role-setup-instance-blankempty/#



Unable to remove the Component Server Site System Role

SCCM Posted on 03/17/2015 10:27:38

Problem:

I am trying to remove a DP from a server. I’ve gone to Administration | Overview | Site Configuration | Servers and Site System Roles

I right-click on the server that is hosting the DP I want to remove and select Delete from the context menu.

However, I then get a Delete Server dialog box stating:

The server “\\<server_fqdn>” cannot be deleted because it contains the following site system roles:

Component server

The component server role supports other site system roles and is created automatically by Configuration Manager. Although there might be a delay, this role is automatically removed after you remove other site system roles on this server.

I’ve tried right-clicking on the Component server role under Site System Roles but the Remove Role option is greyed out so I’m unable to remove the Component Server Site System Role.

As this server is only hosting a DP I don’t understand why it has the Component server installed on it.

Resolution:

The server in question must have had another Site System role installed on it at some point in the past as the Component server role gets installed on a server whenever a Site System role is installed with the exception of a DP (so if the server has only ever run as a DP you will not see the Component server).

Chances are a role other than the DP was installed at some point in the past and removed but the Component server role hasn’t been removed for some reason.

The quickest way to kickstart this is on the affected server:

Right-click Site system under Site system Roles and select Properties from the context menu.

Make a change to a setting on the Site system properties screen such as checking the Require the site server to initiate connections to this site system then click OK.

Wait 10 – 15 minutes.

Refresh the console and the Component server role should now have disappeared.

You should now be able to delete the server hosting the DP.

– See more at: http://www.faqshop.com/wp/configmgr/cm12/cm12trobshoot/cm12sitesys/unable-remove-component-server-site-system-role#sthash.VzDrv9CV.dpuf

http://www.faqshop.com/wp/configmgr-2012-unable-remove-component-server-site-system-role



OSD Deploying ConfigMgr Hotfixes

SCCM Posted on 03/11/2015 12:22:05

http://blogs.technet.com/b/configmonkey/archive/2013/11/13/deploying-configmgr-hotfixes.aspx#_Operating_System_Deployments



oobe.xml example

SCCM Posted on 03/11/2015 10:58:57

<?xml version=”1.0″ encoding=”utf-8″ ?>
<!– Oobe.xml sample file for the region: Catalonia, Spain
For more info, see Configure Oobe.xml,
http://go.microsoft.com/fwlink/?LinkId=317086 –>
<FirstExperience>
<oobe>
<oem>
<name>Fabrikam</name>
<!– Name of the manufacturer –>

<eulafilename>fabrikam_eula.rtf</eulafilename>
<!– If a relative path is used, it will start from the same folder as Oobe.xml.
Example: %WINDIR%\System32\Oobe\Info\Default\1031\fabrikam_eula.rtf –>
</oem>

<defaults>
<!– Set the defaults for the language, location, locale, keyboard, and timezone –>
<language>1027</language>
<!– App language.
See Available Language Packs for Windows, Language decimal identifier
http://go.microsoft.com/fwlink/?LinkId=206620 –>

<location>217</location>
<!– Country or region where the PC is deployed.
See Table of Geographical Locations, Geographic location identifier (decimal)
http://go.microsoft.com/fwlink/?LinkId=141804 –>

<locale>1034</locale>
<!– PC locale. Determines sorting, time/date formatting, and keyboards/IMEs.
See Default Input Locales for Windows Language Packs, keyboard decimal identifier:
http://go.microsoft.com/fwlink/?LinkId=325349 –>

<keyboard>0000080a</keyboard>
<!–Keyboard layout.
Use the keyboard value list in the registry under
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layouts,
or see Windows Language Pack Default Values, keyboard pair:
http://go.microsoft.com/fwlink/p/?LinkId=262262 –>

<timezone>Central Europe Daylight Time</timezone>
<!– Use the time zone list in the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones –>

<adjustForDST>true</adjustForDST>
<!– Use this to adjust the time for Daylight Savings Time –>

</defaults>
</oobe>
</FirstExperience>



Performance Indicator for SSD

SCCM Posted on 03/06/2015 14:34:34

OSD Task Sequence

Run Performance Indicator
WinSAT.exe formal
%SystemRoot%\System32



Create RolloutFile in TaskSequence

SCCM Posted on 02/26/2015 14:02:38

copy /y NUL C:\Windows\Temp\SDT_Microsoft_Windows_10_EN_Deployed.txt >NUL



Changing the language of the SCCM Console

SCCM Posted on 02/23/2015 12:56:26

Rename the language pack folder within the install directory of your Management console.

System Center Configuration Manager 2012:
C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\{language_code}

Close the management console.

Rename the language pack folder corresponding to your situation.

In my case it is nl.

Rename it to nl_backup.

Restart your console.



Activate Office/Windows under Task Sequence

SCCM Posted on 02/23/2015 11:18:34

Office:

Set KMS Host

cscript OSPP.VBS /sethst:KMS.FQDN.local

C:\Program Files (x86)\Microsoft Office\Office15

—-

Activate Product

cscript OSPP.VBS /act

C:\Program Files (x86)\Microsoft Office\Office15

—-

Install for non windows-kms server

office2013volumelicensepack_x86_en-us.exe

http://www.microsoft.com/en-us/download/details.aspx?id=35584

————

Windows:

Set KMS Host

cscript slmgr.vbs /skms KMS.FQDN.local:1688

C:\Windows\System32

—-

Activate Product

cscript slmgr.vbs /ato

C:\Windows\System32

—-



Show Pop-up message OSD TS

SCCM Posted on 02/20/2015 10:32:36

PowerShell.exe -command “& { $ReturnCode = (New-Object -COMobject wscript.shell).popup(\”NO OSDprocessorArchitecture defined. Device ‘ll be formated, but no OS ‘ll be installed!\”,0,\”Warning\”,0x00040016); eXit $ReturnCode}”

Test Step – Check if OS Architecture is defined!

http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

Tasksequence variable bij options

_____

PowerShell.exe -ExecutionPolicy ByPass -Command “& { (New-Object -COMobject wscript.shell).popup(\”Entered a OSDTestStep, OSDTestRun is activated. Press OK to Continue. \”,0,\”Information\”,0x00040041); eXit $ReturnCode}”​



WinPE: Change keyboardlayout

SCCM Posted on 02/19/2015 16:17:33

Run command line

Wpeutil SetKeyboardLayout 0813:00000813

or with powershell

Set-WinUserLanguageList nl-BE

or with DISM
See other post



The software change returned error code SCCM

SCCM Posted on 02/16/2015 16:11:57

0x87D00324

This will indicate that software installation was succesfull, but detection method sucks.



DISM: disable features

SCCM Posted on 02/12/2015 14:15:13

OSDDisableFeatures.ps1

DISM /online /Disable-Feature /FeatureName:MediaCenter /Quiet /NoRestart

write-host “Successfully removed Media Center”

DISM /online /Disable-Feature /FeatureName:FaxServicesClientPackage /Quiet /NoRestart

write-host “Successfully removed Windows Fax and Scan”

DISM /online /Disable-Feature /FeatureName:OpticalMediaDisc /Quiet /NoRestart

write-host “Successfully removed Windows DVD Maker”

http://tweaks.com/windows/40255/manage-windows-features-from-command-line-with-dism/



Prompt for Computer Name during SCCM OSD

SCCM Posted on 02/11/2015 11:45:45

With this method you don’t have to import a computer in SCCM 2012 with the MAC-Address.

Just start the tasksequence as an unknown computer …

To do this, complete the following steps, if you need any assistance, just post a comment at the bottom of this post.

Open your Configuration Manager console and go to the Assets and Compliance Workspace and then click on Device Collections.

Right click on the collection you want to deploy the OS to then click Properties (for this guide I’m using All Unknown Computers). You then need to click on the Collection Variables tab.

Click on the new button as circled below:

In the variable name type OSDCOMPUTERNAME and leave the value areas blank and then click ok.

Once you have this collection variable in your collection property settings, you can then deploy your OSD task sequence to this collection and you will be prompted to enter your computer name.

– See more at: http://www.techygeekshome.co.uk/2012/12/prompt-for-computer-name-during-sccm-osd.html#sthash.5fguzzbD.dpuf

http://www.techygeekshome.co.uk/2012/12/prompt-for-computer-name-during-sccm-osd.html



SMSTSPostAction

SCCM Posted on 02/11/2015 11:35:56

This task sequence variable can be used to configure a post action for a task sequence. To configure this, follow the next steps:

  • Open a task sequence in the Task Sequence Editor.
  • Add a Set Task Sequence Variable –step to the task sequence.
  • Fill in as Task Sequence Variable SMSTSPostAction and, in this example, as Valuecmd /c shutdown /s /t 0 /f.
  • Close the Task Sequence Editor.

http://www.petervanderwoude.nl/post/how-to-perform-an-action-directly-after-the-task-sequence-is-finished-with-configmgr-2012/



Detection Method for a certificate

SCCM Posted on 02/11/2015 11:35:17

HKLM\SOFTWARE\Microsoft\SystemCertificates\TrustedPublisher\Certificates\6BFF5439A57586FEF61B8D8E2194A96DD459B511



Win 8.1 OSD with Language Packs

SCCM Posted on 02/04/2015 15:05:38

Apply Operating System English
Apply Operating System French
Apply Operating System Dutch
Use an unattended or Sysprep answer file
-> PKG_Win8.1_Unattend_NL
—> Unattend.xml

Apply Language EN (OSLanguage equals “EN”)
Apply Language FR (OSLanguage equals “FR”)
Apply Language NL (OSLanguage equals “NL”)
-> Apply NL Language Pack
—> cmd /c dism.exe /online /add-package /packagepath:lp.cab
—> Package: PKG_Microsoft_LanguagePack_Win8.1_01.00_NL -> lp.cab
-> BCDEdit to NL
—> cmd /c bcdedit /set {current} locale nl-NL
-> BCDBoot to NL
—> cmd /c bcdboot %WinDir% /l nl-NL
-> Remove EN-US
—> cmd /c reg delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\en-US /f
-> Restart Computer



Transform AD User Group to Device Collection

SCCM Posted on 07/15/2014 14:44:17

AD:

The AD Computer object must fill in the ManagedBy field with the Primary User

The AD User must be added to a AD User Group

SCCM:

System Discovery has to be extended with the ManagedBy field

User Discovery has to be extended with the Distinguishedname field

SCCM Collection Query:

select
SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
from SMS_R_System where SMS_R_System.managedBy in (select
SMS_R_User.distinguishedName from SMS_R_User where SMS_R_User.UserGroupName =
“DOMAIN\\GG_SDC_Manufact_App_11.0_01.01_EN_INSTALL”) order by
SMS_R_System.Name