Thursday, July 30, 2015

SCCM 2012-Find out who created a Collection

Recently I came across a badly created Collection in our environment and wanted to know who had created it.
It is not possible from Collection properties to find out.

So, to find the person who created it, open SCCM reports, go to Status Messages > All messages for a specific message ID.

In the report parameters, put "30015" and run the report. You get the details of all Collection created messages and you can search for your Collection.

Other message Ids:

Message ID Description


30015 User “<>” created a collection named “Collection Name” (CollID)
30016 User “<>” modified the Collection Properties for a collection named “Collection Name” (CollID)
30017 User “<>” deleted a collection named “Collection Name” (CollID)
30104 User “<>” requested that the membership be refreshed for collection “Collection Name” (CollID)
30107 User “<>” requested that the CCRs be generated for collection “Collection Name” (CollID)
30066 User “<>” deleted a discovered resource named “ComputerName” ResourceID

Friday, July 17, 2015

DFS error-The DFS Replication service stopped replication on replicated folder xxxxxx at local path xxxxx due to Error ID: 9073

While configuring DFS replication on a 2012 server, I was constantly getting this error in the Eventlog

The DFS Replication service stopped replication on the replicated folder at local path XXX

Additional Information:
Error: 9073 (Content set initialization is pending journal wrap task to resume journal read) 

ID 4004



I tried removing DFSR, reinstalling DFSR, removing the server from replication members, but could not fix it.






Solution:
Take a backup of any required folders.  
Stop DFS Replication Services
Unhide and grant yourself access to the C:\System Volume Information folder. To Unhide, from the folder options, unselect "hide system folders".
Open a command prompt with elevated privileges.
Change to the System Volume Information directory where replication target folders are present.
Run the following command RMDIR DFSR /S
Choose yes if you are sure to continue.
Rrestart DFS Replication Services

To check DFS status, open command prompt with elevated privileges and run 

wmic /namespace:\\root\microsoftdfs path dfsrreplicatedfolderinfo get replicatedfoldername,state

Monday, July 13, 2015

SCCM2012-Removing orphaned DP server from Primary Console and DB

Recently, we had two servers with DP roles, to be removed. But, I could not do a clean uninstall as they were already down.
I removed the DP role from the Console, but when trying to delete the server, I got this error:

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

Component server


I remember installing PXE role on it and then removing it.

Resolution:

1. Make sure all the roles apart from Component Server and Site System are removed.
2. On the Primary Server open regedit, go to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Components\SMS_SITE_COMPONENT_MANAGER\Component Servers\OFFLINESERVERNAME

Under Components/each sub key there will be a value called Deinstallation Start Time.
This indicates how long server has been trying to reach the DP.
Change this to 1.
3. Stop and restart the SMS_SITE_COMPONENT_MANAGER service .

Again wait for some hours, and the Component server will be removed and you can delete the Server.


The server “\\<server_fqdn>” cannot be deleted because it contains the following site system roles:
Component server
- See more at: http://www.faqshop.com/wp/configmgr-2012-unable-remove-component-server-site-system-role#sthash.d2I35KS6.dpuf
The server “\\<server_fqdn>” cannot be deleted because it contains the following site system roles:
Component server
- See more at: http://www.faqshop.com/wp/configmgr-2012-unable-remove-component-server-site-system-role#sthash.d2I35KS6.dpuf
The server “\\<server_fqdn>” cannot be deleted because it contains the following site system roles:
Component server
- See more at: http://www.faqshop.com/wp/configmgr-2012-unable-remove-component-server-site-system-role#sthash.d2I35KS6.dpuf
The server “\\<server_fqdn>” cannot be deleted because it contains the following site system roles:
Component server
- See more at: http://www.faqshop.com/wp/configmgr-2012-unable-remove-component-server-site-system-role#sthash.d2I35KS6.dpuf

Sunday, June 28, 2015

SQL 2012 Express SP1 commandline

If you want to upgrade SQL 2012 Express to SP1, this is the command:


setup.exe /qs /IAcceptSQLServerLicenseTerms /Action=Patch /InstanceName=Configmgrsec

Download, extract the exe and run this.

This is for upgrading SQL to SP1 on CM2012 DP servers.

Thursday, May 28, 2015

Script to list out Collection schedules of all collection in SCCM to a output file

Option Explicit

Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objLogFile : Set objLogFile = objFSO.CreateTextFile("Collections.log")

Dim strSourceServer
strSourceServer   = "XXX"
Dim strSourceSiteCode
strSourceSiteCode = "XXX"

Dim objSourceWMIService
Dim AllCollections
Dim objCollection
Dim strCollectionName
Dim strCollectionComment
Dim schedule
Dim schedtype
Dim bolScheduleAvailable
Dim strRecur
Dim strEvery

Set objSourceWMIService = GetObject("winmgmts://" & strSourceServer & "\root\sms\site_" & strSourceSiteCode)

'objLogFile.WriteLine Now & " start "

'Loop trought all collections exsisting on the source server
Set AllCollections = objSourceWMIService.ExecQuery("SELECT * FROM SMS_Collection WHERE NAME NOT LIKE 'All%' AND NAME NOT LIKE 'Root%'")

For Each objCollection In AllCollections
    strCollectionName    = objCollection.Name
    strCollectionComment = objCollection.Comment

    'objLogFile.WriteLine Now & " - Collection  " & objCollection.Name

    Set objCollection = objSourceWMIService.Get("SMS_Collection='" & objCollection.CollectionID & "'" )

    'Get Collection schedule
    On Error Resume Next
    Set schedule = objCollection.RefreshSchedule(0)

    On Error GoTo 0

    If Err.Number = 424 Then
        objLogFile.WriteLine "Collection has no Schedule  " & objCollection.Name
    ElseIf Err.Number <> 0 Then
        objLogFile.WriteLine "An Error (" & Err.Number & ") occured while getting the Update Schedule from " & objCollection.Name
    Else
        'On Error Resume Next
        schedtype = Schedule.Path_.Class

        Select Case (schedtype)
            Case "SMS_ST_RecurInterval"
                If schedule.MinuteSpan <> 0 Then strRecur = "Minute"
                If schedule.HourSpan <> 0 Then strRecur = "Hour"
                If schedule.DaySpan <> 0 Then strRecur = "Day"

                If schedule.MinuteDuration <> 0 Then strEvery = schedule.MinuteDuration
        If schedule.HourDuration <> 0 Then strEvery = schedule.HourDuration
        If schedule.DayDuration <> 0 Then strEvery = schedule.DayDuration

                    bolScheduleAvailable = True
                    objLogFile.WriteLine objCollection.Name & ",Recurr every " & strEvery & " " &  strRecur & ",Starting " & schedule.StartTime

                Case "SMS_ST_RecurWeekly"

                    If schedule.ForNumberOfWeeks <> 0 Then  strRecur = "Weekly"

                    bolScheduleAvailable = True
                    objLogFile.WriteLine objCollection.Name & ",Recurr every " & strRecur & ",Starting " & schedule.StartTime

                Case "SMS_ST_RecurMonthlyByDate"

            If schedule.ForNumberOfMonths <> 0 Then strRecur = "Monthly"
                    bolScheduleAvailable = True
                    objLogFile.WriteLine objCollection.Name & ",Recurr every " & strRecur & ",Starting " & schedule.StartTime
                Case "SMS_ST_RecurMonthlyByWeekday"

                    Token.StartTime = schedule.StartTime
                    objLogFile.WriteLine Now & " - SMS_ST_RecurMonthlyByWeekday Schedule available " & objCollection.Name

                    bolScheduleAvailable = True

                Case "SMS_ST_NonRecurring"

                    bolScheduleAvailable = True
                    objLogFile.WriteLine Now & " - SMS_ST_NonRecurring Schedule available " & objCollection.Name

                Case Else
                    bolScheduleAvailable = False
                    objLogFile.WriteLine Now & " - Unknown Schedule (skipping) " & objCollection.Name
            End Select

        End If

    Next

    objLogFile.WriteLine Now & " - Finish"
    WScript.Echo "Done"

Customize the CM2012 console

This is how you can customize the CM2012 console.
Suppose you want the Description field to be always next to the DP name, in Administration workspace, Distribution points node.

Go to %ConfigMgrInstallPath%\AdminConsole\Bin.  Locate and open AdminUI.ConsoleBuilder.exe

Click on File > Open > ConnectedConsole
  

 The ConnectedConsole view will load.  Notice at the bottom left corner, you will see "text" representation of the ConfigMgr 2012 console workspaces.

 

On Left handside, click on Overview/Distribution Points

On Right side, click on Views tab, Edit.
 

Click Configure










In the Property Display Items section, under Class Properties, you can moved the fields up or down as you want.







Close the reopen you CM2012 Console.

Install Active Directory tools on Windows 7

First download RSAT for Windows 7.

The Remote Server Administration Tools (RSAT) for Windows 7 can be downloaded from Microsoft's web site:
https://www.microsoft.com/en-us/download/details.aspx?id=7887


After downloading and installing the tool on your Windows 7 computer, use the Turn Windows features on or off function from Control Panel, to enable AD management tools.

  • From the Control Panel, click on Programs.
  • Under Programs and Features, select Turn Windows features on or off.
  • Under Remote Server Administration Tools > Role Administration Tools, select AD DS and AD LDS Tools.

Friday, January 30, 2015

Install windows roles/features through Powershell in 2012 server

Run the below Powershell commands to list and install roles/features:

 Get-WindowsFeature












X means Installed.

From the Name, you can install a feature:

e.g. Install-WindowsFeature  FS-BrancCache

For some roles, you might need to provide the Windows installation folder.
(usually C:\Windows\WinSxS).

Thursday, January 29, 2015

Install CM2012 DP role through Powershell

In CM2012, there is a lot of support to automate tasks using Powershell. One of the tasks is installing CM2012 Distribution Points.

Here are the commands:

Install Site System:


New-CMSiteSystemServer –SiteCode 'XXXX' –UseSiteServerAccount –ServerName '<FQDN>'


Check that SiteSystem has been installed in the console of Primary CAS.
 


Once the site system has been added to the Configuration Manager environment we can then use Add-CMDistributionPoint to add the DP role. Wait for Site System to appear, before installing DP role!

Add-CMDistributionPoint –SiteCode 'XXXX' –SiteSystemServerName '<FQDN>' –CertificateExpirationTimeUtc '1/1/2113 1:00 AM' –MinimumFreeSpaceMB 10240 –InstallInternetServer
 
Set-CMDistributionPoint –SiteCode 'XXXX' –SiteSystemServerName '<FQDN>' -AllowPreStaging 1 –EnablePxeSupport 1 –AllowRespondIncomingPxeRequest 1 -EnableUnknownComputerSupport 1 -EnableMulticast 1 -StartUdpPort 64001 -EndUdpPort 65000  -EnableValidateContent 1 -EnablePullDP 1
 
Set-CMDistributionPoint –SiteCode 'XXXX' –SiteSystemServerName '<FQDN>'  -ComputersUsePxePassword (convertto-securestring -string 'Your PXE password' -force -asplaintext)

You can check sitecomp.log for DP role installation.