Showing posts with label SCCM2012R2. Show all posts
Showing posts with label SCCM2012R2. Show all posts

2015/09/03

PowerShell/SCCM - Find Applications advertised to a user

The following function helps you retrieve all the deployment that a user is supposed to received.

We use this during the Operating System Deployment (OSD). Using the UDI we get the user account that will receive the workstation currently being deployed. This script allow us to retrieve in SCCM all the Application advertised on the user that needed to be deployed on the computer during the task sequence.

I know this could probably be done with the Configuration Manager module, but I'm pretty new with it and I was not sure it could be loaded in a task sequence, if you have the answer let me know in the comment section.

Here is the step by step how I found my solution. You can also go straight to the function at the end of this article.

Define Default Parameters

First I define a splatting to avoid repeating the same parameters in each command.
# Define default parameters (Splatting)
$Splatting = @{
    ComputerName = "Sccm01.lazywinadmin.com"
    NameSpace = "root\SMS\Site_FX1"
}

Retrieve a user in SCCM CMDB

Then I need to find a user in the SCCM Database to retrieve its ResourceID.
# Find the User in SCCM CMDB
$User = Get-WMIObject @Splatting -Query "Select * From SMS_R_User WHERE UserName='FxTest'"

Retrieve the collections the user is member of

# Find the collections where the user is member of
$Collections = Get-WmiObject -Class sms_fullcollectionmembership @splatting -Filter "ResourceID = '$($user.resourceid)'"

2015/08/15

Windows 10 ADK - Issues while uninstalling Windows 8.1 ADK and installing Windows 10 ADK

Installing Windows 10 Assessment and Deployment Kit (ADK) on SCCM 2012 R2 SP1 was a bit tricky. To "upgrade" the Windows ADK from 8.1 to 10, Microsoft recommend to remove Windows 8.1 ADK prior to the installation of Windows 10 ADK. We had some issue uninstalling Windows 8.1 ADK and installing the Windows 10 ADK


Uninstalling the Windows 8.1

Issue

Uninstall did not complete successfully.
An error occured while uninstalling "Deployment Tools."

Could not acquire privileges; GLE=0x514
Returning Status 0x514

You can also look at the ADK install/uninstall logs here: C:\Users\<Account>\AppData\Local\Temp\adk


We found different solutions online such as:

  • Unjoin, install ADK and Rejoin the computer to the domain
  • Run the installer as a Local Administrator or domain admin
Unjoining the machine was out of questions and the second solution did not work (Same error message).

I also tried to
  • Remove one component at the time but always got stuck on the "Deployment Tools" component.
  • Repair W8.1 ADK and try again
Same result...