Popular Posts

Wednesday, November 7, 2018

Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.





Here are the symptoms:
  1.      Cannot find C and D etc. drives in windows/file explorer
  2.      Unable to disconnect the mapped drive (etc K drive) – error message is “This network connection does not exist”
  3.      Net use command does not list this drive
  4.      Noticed group policy configured for both machine and user to map this drive during startup and login respectively
  5.      A script was also placed in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup to configure the mapped drive at startup

Actions taken:
6.      1. Disabled group policy stated in #3 above
7.      2. Removed the script from startup folder in #4 above
   3. Rebooted and issue was fixed
   4. Placed the script back on startup folder and rebooted again which did not re-produce the error.
   5. Furthermore, HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\ Explorer   Value: NoDrives was set to 0 to show all drives.

Sunday, September 2, 2018

PowerShell scripts to run Config Mgr actions for Machine policy update and software update cycles and check number of missing updates



Run CM actions script

function RecurssiveTimer([int]$time){

if ($time -eq 0){
return
}

write-host "$time*" -NoNewline

$time--

Start-sleep -s 60

RecurssiveTimer -time $time

}


function Run-CMactions{

Write-Host "##### Running Configuration Manager Client Actions #####"

try{

Write-Host "## Running Machine Policy Retrieval & Eval. Cycle ##"

Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule “{00000000-0000-0000-0000-000000000021}” | Out-null

Write-Host "Sleeping for 15 minutes..."

RecurssiveTimer -time 15

try{

Write-Host "## Running Software Updates Deployment Eval. Cycle ##"

Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule “{00000000-0000-0000-0000-000000000108}” | Out-null

Write-Host "## Running Software Updates Scan Cycle ##"

Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule “{00000000-0000-0000-0000-000000000113}” | Out-null

Write-Host "Sleeping for 5 minutes..."

RecurssiveTimer -time 5

return 0

}

catch{

throw

Write-Host -BackgroundColor Red "Error Running Software Update Cycles"

return -1

}

}

catch{

throw
Write-Host -BackgroundColor Red "Error Running Machine Policy Retrieval & Eval. Cycle"

return -1

}

}


Run-CMactions



Check compliance script

write-host "Checking compliance"

$Deployments = Get-WmiObject -Namespace root\ccm\SoftwareUpdates\DeploymentAgent -Query "Select * from CCM_AssignmentCompliance" -ErrorAction SilentlyContinue

if($Deployments){

$Updatestargeted = Get-WmiObject -Namespace root\ccm\SoftwareUpdates\DeploymentAgent -Query "Select * from CCM_TargetedUpdateEX1 where UpdateState = 0" -ErrorAction Stop

if($Updatestargeted){

$iMissing=0
$Updatestargeted | ForEach-Object {

$iMissing++

}
write-host -BackgroundColor Red "Number of Missing Updates: $iMissing"
write-host $iMissing
return $iMissing

}

else {

Write-Host -BackgroundColor Green -ForegroundColor Black "No Missing Software Updates Found"
return 0

}

}

else{

write-host -BackgroundColor Red "No Deployments Assigned"
return 0
}


Monday, August 27, 2018

Ansible Tower issues and fixes

1)

Issue:

UNREACHABLE! => {"changed": false, "msg": "kerberos: authGSSClientInit() failed: (('Unspecified GSS failure.  Minor code may provide more information', 851968), (\"Can't find client principal user@domain in cache collection\", -1765328243))", "unreachable": true}

Fix:

Perform the following steps on all ansible node(s)

  1. sudo su awx
  2. kinit user@domain.com and enter password
  3. ensure that job isolation is disabled (More information on job isolation can be found at Configure Tower in Tower-Jobs)

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