CCMSetup.log ‘Failed to download client files by BITS. Error 0x80080005’

When attempting to install the ConfigMgr client on a computer error ‘Failed to download client files by BITS. Error 0x80080005’ is seen in the CCMSetup.log file.

The BITS service is stopped and gives an error when trying to start it.

When checking the System Event Log, the following error occurs for the Bits-Client source with event ID 16392.

The BITS service failed to start. Error 0x8E5E0226.

The fix, as found here, is to remove all files from “C:\ProgramData\Microsoft\Network\Downloader”, then try to start the BITS service.

Remove-Item -Path c:\ProgramData\Microsoft\Network\Downloader -Filter * -Force -Recurse

PowerShell Profile Locations

PowerShell uses different profile files depending on which Host, or application you’re using.

Below are the defaults for PowerShell 5.1

All Users, All Hosts (PowerShell console, ISE) – $PSHOME\Profile.ps1

All Users, Current Host (PowerShell console) – $PSHOME\Microsoft.PowerShell_profile.ps1

    All User, Current Host (VS Code) – $PSHOME\Microsoft.VSCode_profile.ps1

    Current User, All Hosts (PowerShell console, ISE) – $HOME\Documents\WindowsPowerShell\Profile.ps1

    Current user, Current Host (PowerShell console) – $HOME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

    Current user, Current Host (VS Code) – $HOME\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1

    To edit or create each of the profile files, you can use the following commands with the $Profile variable:

    Current User, Current Host – notepad $PROFILE

    Current User, Current Host – notepad $PROFILE.CurrentUserCurrentHost

    Current User, All Hosts – notepad $PROFILE.CurrentUserAllHosts

    All Users, Current Host – notepad $PROFILE.AllUsersCurrentHost

    All Users, All Hosts – notepad $PROFILE.AllUsersAllHosts


    PowerShell tip: $PSDefaultParameters

    If you’re an avid user of PowerShell you’ve probably, at some point gotten sick of providing values for the same parameters over and over. The solution, use $PSDefaultParameters. Using this preference variable you can set default values like the DC used with the AD cmdlets, the SQL server you connect to, or the error preference for all cmdlets or a subset. This means you can essentially pre-enter the desired value once, and the cmdlet will automatically use it. Pretty cool, huh?

    Examples:
    $PSDefaultParameterValues["*-AD*:Server"] = "dc01.corp.viamonstra.com"

    Add/Remove single entries:
    $PSDefaultParameterValues.Add('Get-ADComputer:Server', 'dc01')
    $PSDefaultParameterValues.Remove('*-GPO:Name')

    The $PSDefaultParameterValues variable is only available in the session you set it in. The easiest way to take advantage of $PSDefaultParameterValues is to add them to you PowerShell profile. That way each time you start a PowerShell session, the default values are already set for you.

    PowerShell profile example:
    $PSDefaultParameterValues['Get-ChildItem:Force'] = $true
    $PSDefaultParameterValues[':ErrorAction'] = 'Stop' $PSDefaultParameterValues['Get-:Recurse'] = $true

    Here is a link to Microsoft’s documentation of $PSDefaultParameters.

    SQL to retrieve all collections

    Below is the SQL code needed to retrieve all of the collections from ConfigMgr. This is useful when creating custom reports that need to be scoped to a specific collection. The query below selects the CollectionName and CollectionID columns and sorts the CollectionName column alphabetically.

    SELECT        CollectionName, CollectionID
    FROM            v_Collections
    ORDER BY CollectionName
    

    Results from the query on my test system.

    Copy GPO with PowerShell

    If you need to make a copy of a group policy, using the Group Policy Management Console can be a slow process. Using PowerShell is a much faster process.

    All you need is the name of the source GPO copied to the clipboard.

    Copy-GPO -SourceName "Edge Browser Settings - Test" -TargetName "Edge Browser Settings - Prod"
    

    You can also copy by using the GUID of the source and/or destination GPO. In addition, you can copy GPOs between domains.

    copy-gpo -SourceName "Edge Browser Settings - Test" -SourceDomain "corp.viamonstra.com" -TargetName "Edge Browser Settings - Prod" -TargetDomain "lab.viamonstra.com"
    

    I don’t have an image of copying between domains because my lab only contains a single domain.

    SQL to get last hardware scan

    The last hardware scan is stored in the view v_GS_WORKSTATION_STATUS. When joined with either v_R_System_Valid or v_R_System, you can retrieve the last hardware scan for a computer.

    The SQL code below will return the last hardware scan date for all computers in the ConfigMgr system.

    SELECT        v_R_System_Valid.Netbios_Name0, v_GS_WORKSTATION_STATUS.LastHWScan
    FROM            v_GS_WORKSTATION_STATUS INNER JOIN
                             v_R_System_Valid ON v_GS_WORKSTATION_STATUS.ResourceID = v_R_System_Valid.ResourceID
    Results from the above query.

    If you need to return the last hardware scan for a single computer you can use the query below to filter by the computer name. In this example, we filtered on computer ‘pc01’.

    SELECT        v_R_System_Valid.Netbios_Name0, v_GS_WORKSTATION_STATUS.LastHWScan
    FROM            v_GS_WORKSTATION_STATUS INNER JOIN
                             v_R_System_Valid ON v_GS_WORKSTATION_STATUS.ResourceID = v_R_System_Valid.ResourceID
    WHERE        (v_R_System_Valid.Netbios_Name0 = N'pc01')
    Results from the above query.

    Automatic virtual machine activation

    How do you activate your Server VMs running under Hyper-V? If you’re in a production environment you likely use a KMS server. But what about test/dev environments, or home labs? Luckily, there is another option, if you’re using the Datacenter edition of Windows. Before anyone freaks out about the Datacenter requirement, that edition is included with the Visual Studio subscriptions, and is available to many college students for free as part of Microsoft’s Imagine Premium program.

    Continue reading