/build/static/layout/Breadcrumb_cap_w.png

Forcing SCCM H/W Inventory Full.

Forcing SCCM H/W Inventory Full.

Use hardware inventory in System Center Configuration Manager to collect information about the hardware configuration of client devices in your organization. To collect hardware inventory, the Enable hardware inventory on clients setting must be enabled in client settings.

Hardware inventory needs to be sent to SCCM server so that machine information has been restored with updated database. 

For Single Machine.

$comp=”localhost”

$HardwareInventoryID = '{00000000-0000-0000-0000-000000000001}'

    Get-WmiObject -ComputerName $comp -Namespace   'Root\CCM\INVAGT' -Class 'InventoryActionStatus' -Filter "InventoryActionID='$HardwareInventoryID'" | Remove-WmiObject

    Start-Sleep -s 5

    Invoke-WmiMethod -computername $comp -Namespace root\CCM -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000001}"

   

 

For Multiple Machine

1.       It will check whether machine is online

2.       It will check whether C drive has minimum 2GB of space . if not it will try to delete files from c:\windows\temp folder

3.       Run the Hardware inventory on Multiple machines

 

Function HWInv_Full($comp){

   

    $HardwareInventoryID = '{00000000-0000-0000-0000-000000000001}'

    Get-WmiObject -ComputerName $comp -Namespace   'Root\CCM\INVAGT' -Class 'InventoryActionStatus' -Filter "InventoryActionID='$HardwareInventoryID'" | Remove-WmiObject

    Start-Sleep -s 5

    Invoke-WmiMethod -computername $comp -Namespace root\CCM -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000001}"

   

    }

    Function Check_Drive_Space ($comp){

   

    $disk = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='C:'" |

    Foreach-Object {$_.Size,$_.FreeSpace}

   

    $disk = ([wmi]"\\$comp\root\cimv2:Win32_logicalDisk.DeviceID='c:'")

    $free_Space= "{0:#.0}" -f ($disk.FreeSpace/1GB)

    $free_Space

    if ($free_space -le 2) {

    write-output "Cleaning"

    sleep -s 20

      remove-item -force -Recurse "\\$comp\c$\windows\temp\*" -Verbose

    }

   

    }

   

    $computersget-content "c:\computers.txt"

   

    foreach($comp in $computers){

   

        if ((Test-Connection $comp -Count 1 -Quiet) -eq $true){

            Check_Drive_Space ($comp)

            HWInv_Full($comp)

    }

    }

 

 


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ