Jump to content

Search the Community

Showing results for tags 'configmgr 2012'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. This is a script I did ages go to fix problems when you have a lot of DPs on ConfigMgr 2012 and some of the packages are in a stuck or failed state. It's a massive pain to try and fix it manually. ' **************************************************************************** ' ' Purpose: Checks all packages assigned to a DP and redistributes any with errors. ' ' Usage: cscript.exe CM2012_DP_Redist.vbs ' ' Version: 1.0.0 ' ' History: ' 1.0.0 20-Nov-2013 - Jonathan Bennett ' First version. ' ' **************************************************************************** ' **************************************************************************** ' Global constant and variable declarations ' **************************************************************************** Option Explicit ' CHANGEABLE VARIABLES ' The name of the CAS/Primary site server Public Const CASServerName = "CASSERVERNAME" ' Which DP to refresh packages for - leave this blank to check ALL DPs Public Const DPServerName = "DPSERVERNAME" ' END OF CHANGABLE VARIABLES Public Const wbemFlagReturnImmediately = 16 Public Const wbemFlagForwardOnly = 32 Dim oSWbemServices ' **************************************************************************** ' End declarations ' **************************************************************************** ' **************************************************************************** ' Main routine ' **************************************************************************** ' Connect to CM 2012 (CAS) If ConnectServer(CASServerName) = False Then WScript.Echo "Unable to connect to server." WScript.Quit 1 End If ' Find all packages with a bad status Dim queryString Dim dpStatuses, dpStatus, serverName, packageID, packageDPs, packageDP, nalPath If DPServerName = "" Then queryString = "SELECT Name,PackageID,MessageState FROM SMS_DistributionDPStatus WHERE MessageState > 2" Else queryString = "SELECT Name,PackageID,MessageState FROM SMS_DistributionDPStatus WHERE Name LIKE '%" & DPServerName & "%' AND MessageState > 2" End If Set dpStatuses = oSWbemServices.ExecQuery(queryString,, wbemFlagForwardOnly+wbemFlagReturnImmediately) For Each dpStatus in dpStatuses serverName = UCase(dpStatus.Name) packageID = dpStatus.PackageID queryString = "SELECT * FROM SMS_DistributionPoint WHERE PackageID = '" & packageID & "'" Set packageDPs = oSWbemServices.ExecQuery(queryString,, wbemFlagForwardOnly+wbemFlagReturnImmediately) For Each packageDP in packageDPs nalPath = UCase(packageDP.ServerNalPath) If InStr(1, nalPath, serverName) > 0 Then WScript.Echo "Redistributing " & packageID & " on " & serverName & "..." packageDP.RefreshNow = True On Error Resume Next packageDP.Put_ On Error Goto 0 End If Next Next WScript.Quit 0 ' **************************************************************************** ' Functions ' **************************************************************************** Function ConnectServer(ByVal serverName) If serverName = "" Then serverName = "." Dim oSWbemLocator : Set oSWbemLocator = CreateObject("WbemScripting.SWbemLocator") On Error Resume Next Set oSWbemServices = oSWbemLocator.ConnectServer(serverName, "root\sms") If Err.Number <> 0 Then ConnectServer = False Exit Function End If On Error Goto 0 Dim ProviderLoc : Set ProviderLoc = oSWbemServices.ExecQuery("Select * FROM SMS_ProviderLocation WHERE ProviderForLocalSite='True'") Dim Location For Each Location In ProviderLoc Set oSWbemServices = oSWbemLocator.ConnectServer(Location.Machine, "root\sms\site_" + Location.SiteCode) Exit For Next ConnectServer = True End Function More details on this blog post: https://www.autoitconsulting.com/site/deployment/mass-redistribute-packages-configmgr-2012/
×
×
  • Create New...