Popular Posts

Thursday, June 21, 2018

RegTask: Failed to get certificate. Error: 0x80004005

Issue: After installing SCCM 2007 client, the computer is unable to download Actions and components. checking C:\Windows\SysWOW64\CCM\Logs\ClientIDManagerStartup.log shows RegTask: Failed to get certificate. Error: 0x80004005

Solution:

  1. Stop SMS agent host service
  2. Make a backup of C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
  3. Delete the systemfile starting with 19 found in the above folder
  4. Start SMS agent host service

Tuesday, April 10, 2018

Ansible : Win_copy does not copy/create empty directories

win_copy ansible module does not copy or create folder if they are empty.

ex: Running win_copy on the following source will create the following result

#src -->

Main_folder\Folder1\test.txt
Main_folder\Folder2

#dest -->

Main_folder\Folder1\test.txt

Thursday, January 4, 2018

Set DNS server list on a set of clients using SCCM collections


  1. Create a package that calls the following PowerShell script

$logfile = 'C:\Windows\Temp\SetDNS.log'
function writetolog([string] $txt) {        $Stamp = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
    Add-content $logfile -value $Stamp':'$txt
}

try{
    $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
    $DNSServers = $tsenv.Value("DNSservers")    write-host "Retrieved DNS servers list successfully"    writetolog("Retrieved DNS servers list successfully : " + $DNSServers)    $DNSServers = $DNSServers -split ','

}
catch{
    write-host "Cannot retrieve DNS servers list"    writetolog("Retrieved DNS servers list successfully")    exit -1     }

try{
    $Interface = Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “True” -and $_.IPAddress -like "53.*"} -ErrorAction Stop
    write-host "Connected to WMI succesfully and interfaces retrieved"    writetolog("Connected to WMI succesfully and interfaces retrieved")
    Foreach($NIC in $Interface) {
        try{                  $NIC.SetDNSServerSearchOrder($DNSServers)            write-host "DNS servers configured successfully"            writetolog("DNS servers configured successfully")            exit 0
        }        catch{
            write-host "Cannot set DNS servers"            writetolog("Cannot set DNS servers")            exit -1
        }
    }
}
catch{        write-host "Cannot connect to WMI"    writetolog("Cannot connect to WMI")    return -1
}

2. Create a task sequence that installs the above package using Install Software task

3. Create a collection, add the clients that you need to set the DNS for
4. On that collection, set a collection variable called DNSservers and add the list of DNS servers separated by comma



5. Finally advertise the task sequence on this collection