Fixed SCCM queries, woopsie!
This commit is contained in:
parent
c7c4be8a6f
commit
43a85d110a
|
|
@ -12,7 +12,7 @@
|
||||||
RootModule = 'Get-PC.psm1'
|
RootModule = 'Get-PC.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '0.3.16'
|
ModuleVersion = '0.3.17'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|
|
||||||
|
|
@ -348,25 +348,28 @@ function Get-PCBatchInvoke {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BatchInvokesProgressBar -stage 2
|
BatchInvokesProgressBar -stage 2
|
||||||
$jobs = Invoke-Command -ScriptBlock $sblock -ComputerName $OnlineComputers -SessionOption (New-PSSessionOption -NoMachineProfile -OpenTimeout 45000) -AsJob
|
$invokeJob = Invoke-Command -ScriptBlock $sblock -ComputerName $OnlineComputers -SessionOption (New-PSSessionOption -NoMachineProfile -OpenTimeout 45000) -AsJob
|
||||||
BatchInvokesProgressBar -stage 3
|
BatchInvokesProgressBar -stage 3
|
||||||
|
$offlineJobs = @()
|
||||||
if($OfflineComputers.count -gt 0){
|
if($OfflineComputers.count -gt 0){
|
||||||
foreach($computer in $OfflineComputers){
|
foreach($computer in $OfflineComputers){
|
||||||
$jobs += Start-Job -ScriptBlock ${function:SCCMQueryBlock} -ArgumentList $computer
|
$offlineJobs += Start-Job -ScriptBlock ${function:Get-SCCMQueryBlock} -ArgumentList $computer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BatchInvokesProgressBar -stage 4
|
BatchInvokesProgressBar -stage 4
|
||||||
$output += $jobs | Receive-Job -Wait -AutoRemoveJob | Select-Object * -ExcludeProperty RunspaceId, PSComputerName, PSShowComputerName, PSSourceJobInstanceId
|
$output += $invokeJob | Receive-Job -Wait -AutoRemoveJob | Select-Object * -ExcludeProperty RunspaceId, PSComputerName, PSShowComputerName, PSSourceJobInstanceId
|
||||||
|
$output += $offlineJobs | Receive-Job -Wait -AutoRemoveJob | Select-Object * -ExcludeProperty RunspaceId, PSComputerName, PSShowComputerName, PSSourceJobInstanceId
|
||||||
$itemIndex = 0
|
$itemIndex = 0
|
||||||
$contactedhosts = $output.Hostname
|
$contactedhosts = $output.Hostname
|
||||||
BatchInvokesProgressBar -stage 5
|
BatchInvokesProgressBar -stage 5
|
||||||
$missedhosts = $OnlineComputers | Where-Object -FilterScript {$_ -notin $contactedhosts}
|
$missedhosts = $OnlineComputers | Where-Object -FilterScript {$_ -notin $contactedhosts}
|
||||||
|
$missedJobs = @()
|
||||||
if($missedhosts.count -gt 0){
|
if($missedhosts.count -gt 0){
|
||||||
foreach($computer in $missedhosts){
|
foreach($computer in $missedhosts){
|
||||||
$jobs += Start-Job -ScriptBlock ${function:SCCMQueryBlock} -ArgumentList $computer
|
$missedJobs += Start-Job -ScriptBlock ${function:Get-SCCMQueryBlock} -ArgumentList $computer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$output += $jobs | Receive-Job -Wait -AutoRemoveJob | Select-Object * -ExcludeProperty RunspaceId, PSComputerName, PSShowComputerName, PSSourceJobInstanceId
|
$output += $missedJobs | Receive-Job -Wait -AutoRemoveJob | Select-Object * -ExcludeProperty RunspaceId, PSComputerName, PSShowComputerName, PSSourceJobInstanceId
|
||||||
|
|
||||||
return $output
|
return $output
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
#CONST
|
|
||||||
$SITENAME="100"
|
|
||||||
$SCCMSERVER="shscm01.int.samhealth.net"
|
|
||||||
$SCCMNAMESPACE="root\sms\site_100"
|
|
||||||
|
|
||||||
Function Get-SCCMQueryBlock {
|
Function Get-SCCMQueryBlock {
|
||||||
param (
|
param (
|
||||||
[string]$comp,
|
[string]$comp,
|
||||||
[int]$NumberofComputers,
|
[int]$NumberofComputers,
|
||||||
[int]$PCID
|
[int]$PCID
|
||||||
)
|
)
|
||||||
|
#CONST
|
||||||
|
$SITENAME="100"
|
||||||
|
$SCCMSERVER="shscm01.int.samhealth.net"
|
||||||
|
$SCCMNAMESPACE="root\sms\site_100"
|
||||||
|
|
||||||
if(!(Test-Connection -ComputerName $comp -Count 1)){
|
if(!(Test-Connection -ComputerName $comp -Count 1)){
|
||||||
|
|
||||||
|
|
@ -26,9 +26,11 @@ Function Get-SCCMQueryBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0
|
$i = 0
|
||||||
$i++ | ProgressBar $i $comp "SCCM Last Hardware Scan" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Last Hardware Scan" -PercentComplete (($i / 18) * 100)
|
||||||
|
|
||||||
#Last Hardware Scan
|
#Last Hardware Scan
|
||||||
$FindLastHardwareScanQuery = "select SMS_G_System_WORKSTATION_STATUS.LastHardwareScan from SMS_R_System inner join SMS_G_System_WORKSTATION_STATUS on SMS_G_System_WORKSTATION_STATUS.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
$FindLastHardwareScanQuery = "select SMS_G_System_WORKSTATION_STATUS.LastHardwareScan from SMS_R_System inner join SMS_G_System_WORKSTATION_STATUS on SMS_G_System_WORKSTATION_STATUS.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
|
|
||||||
$FindLastHardwareScanSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindLastHardwareScanQuery | Select-Object -ExpandProperty LastHardwareScan
|
$FindLastHardwareScanSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindLastHardwareScanQuery | Select-Object -ExpandProperty LastHardwareScan
|
||||||
|
|
||||||
|
|
@ -73,81 +75,93 @@ Function Get-SCCMQueryBlock {
|
||||||
|
|
||||||
return $obj
|
return $obj
|
||||||
}
|
}
|
||||||
$i++ | ProgressBar $i $comp "Last User SCCM" $NumberofComputers $PCID
|
$i++
|
||||||
$SCCMLastUserLogOnQuery = "select SMS_R_System.LastLogonUserName from SMS_R_System where SMS_R_System.Name = '$ComputerName'"
|
Write-Progress -Activity "Scanning PC $comp" -Status "Last User SCCM" -PercentComplete (($i / 18) * 100)
|
||||||
|
$SCCMLastUserLogOnQuery = "select SMS_R_System.LastLogonUserName from SMS_R_System where SMS_R_System.Name = '$comp'"
|
||||||
$LastUserSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $SCCMLastUserLogOnQuery |
|
$LastUserSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $SCCMLastUserLogOnQuery |
|
||||||
Select-Object -ExpandProperty LastLogonUserName
|
Select-Object -ExpandProperty LastLogonUserName
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM IP Query" $NumberofComputers $PCID
|
$i++
|
||||||
$FindIPQuery = "select SMS_R_System.IPAddresses from SMS_R_System where SMS_R_System.Name = '$ComputerName'"
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM IP Query" -PercentComplete (($i / 18) * 100)
|
||||||
|
$FindIPQuery = "select SMS_R_System.IPAddresses from SMS_R_System where SMS_R_System.Name = '$comp'"
|
||||||
$FindIPSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindIPQuery |
|
$FindIPSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindIPQuery |
|
||||||
Select-Object -ExpandProperty IPAddresses
|
Select-Object -ExpandProperty IPAddresses
|
||||||
if($FindIPSCCM.Count -gt 1){
|
if($FindIPSCCM.Count -gt 1){
|
||||||
$FindIPSCCM = $FindIPSCCM[0]
|
$FindIPSCCM = $FindIPSCCM[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "Find Model SCCM" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "Find Model SCCM" -PercentComplete (($i / 18) * 100)
|
||||||
$FindModelQuery = "select SMS_G_System_COMPUTER_SYSTEM.Model from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on
|
$FindModelQuery = "select SMS_G_System_COMPUTER_SYSTEM.Model from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on
|
||||||
SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$CompModelSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindModelQuery |
|
$CompModelSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindModelQuery |
|
||||||
Select-Object -ExpandProperty Model
|
Select-Object -ExpandProperty Model
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Bios Version" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Bios Version" -PercentComplete (($i / 18) * 100)
|
||||||
$FindBiosVerQuery = "select SMS_G_System_PC_BIOS.SMBIOSBIOSVersion from SMS_R_System inner join SMS_G_System_PC_BIOS on
|
$FindBiosVerQuery = "select SMS_G_System_PC_BIOS.SMBIOSBIOSVersion from SMS_R_System inner join SMS_G_System_PC_BIOS on
|
||||||
SMS_G_System_PC_BIOS.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_PC_BIOS.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindBiosVerSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindBiosVerQuery |
|
$FindBiosVerSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindBiosVerQuery |
|
||||||
Select-Object -ExpandProperty SMBIOSBIOSVersion
|
Select-Object -ExpandProperty SMBIOSBIOSVersion
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM HDD/SSD Space" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM HDD/SSD Space" -PercentComplete (($i / 18) * 100)
|
||||||
$FindFreeSpaceQuery = "select SMS_G_System_LOGICAL_DISK.Size from SMS_R_System inner join SMS_G_System_LOGICAL_DISK on
|
$FindFreeSpaceQuery = "select SMS_G_System_LOGICAL_DISK.Size from SMS_R_System inner join SMS_G_System_LOGICAL_DISK on
|
||||||
SMS_G_System_LOGICAL_DISK.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_LOGICAL_DISK.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$CompFreeSpaceSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindFreeSpaceQuery |
|
$CompFreeSpaceSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindFreeSpaceQuery |
|
||||||
Select-Object -ExpandProperty Size
|
Select-Object -ExpandProperty Size
|
||||||
$CompFreeSpaceSCCMGB = [math]::Round(($CompFreeSpaceSCCM / 1000), 2)
|
$CompFreeSpaceSCCMGB = [math]::Round(($CompFreeSpaceSCCM / 1000), 2)
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM RAM" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM RAM" -PercentComplete (($i / 18) * 100)
|
||||||
$FindMemoryQuery = "select SMS_G_System_X86_PC_MEMORY.TotalPhysicalMemory from SMS_R_System inner join SMS_G_System_X86_PC_MEMORY on
|
$FindMemoryQuery = "select SMS_G_System_X86_PC_MEMORY.TotalPhysicalMemory from SMS_R_System inner join SMS_G_System_X86_PC_MEMORY on
|
||||||
SMS_G_System_X86_PC_MEMORY.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_X86_PC_MEMORY.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindMemorySCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindMemoryQuery |
|
$FindMemorySCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindMemoryQuery |
|
||||||
Select-Object -ExpandProperty TotalPhysicalMemory
|
Select-Object -ExpandProperty TotalPhysicalMemory
|
||||||
$FindMemorySCCMGB = [math]::Round($FindMemorySCCM / 1MB)
|
$FindMemorySCCMGB = [math]::Round($FindMemorySCCM / 1MB)
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Asset Tag" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Asset Tag" -PercentComplete (($i / 18) * 100)
|
||||||
$FindAssetTagQuery = "select SMS_G_System_SYSTEM_ENCLOSURE.SMBIOSAssetTag from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on
|
$FindAssetTagQuery = "select SMS_G_System_SYSTEM_ENCLOSURE.SMBIOSAssetTag from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on
|
||||||
SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name = '$ComputerName'"
|
SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name = '$comp'"
|
||||||
$FindAssetTagSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindAssetTagQuery |
|
$FindAssetTagSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindAssetTagQuery |
|
||||||
Select-Object -ExpandProperty SMBIOSAssetTag
|
Select-Object -ExpandProperty SMBIOSAssetTag
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Service Tag" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Service Tag" -PercentComplete (($i / 18) * 100)
|
||||||
$FindServiceTagQuery = "select SMS_G_System_SYSTEM_ENCLOSURE.SerialNumber from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on
|
$FindServiceTagQuery = "select SMS_G_System_SYSTEM_ENCLOSURE.SerialNumber from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on
|
||||||
SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindServiceTagSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindServiceTagQuery |
|
$FindServiceTagSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindServiceTagQuery |
|
||||||
Select-Object -ExpandProperty SerialNumber
|
Select-Object -ExpandProperty SerialNumber
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM OS Name" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM OS Name" -PercentComplete (($i / 18) * 100)
|
||||||
$FindOSNameQuery = "select SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_OPERATING_SYSTEM.OSArchitecture, SMS_G_System_OPERATING_SYSTEM.BuildNumber from
|
$FindOSNameQuery = "select SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_OPERATING_SYSTEM.OSArchitecture, SMS_G_System_OPERATING_SYSTEM.BuildNumber from
|
||||||
SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID =
|
SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID =
|
||||||
SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindOSNameSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindOSNameQuery |
|
$FindOSNameSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindOSNameQuery |
|
||||||
Select-Object -ExpandProperty Caption
|
Select-Object -ExpandProperty Caption
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM OS Architecture" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM OS Architecture" -PercentComplete (($i / 18) * 100)
|
||||||
$FindOSNameQuery = "select SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_OPERATING_SYSTEM.OSArchitecture, SMS_G_System_OPERATING_SYSTEM.BuildNumber from
|
$FindOSNameQuery = "select SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_OPERATING_SYSTEM.OSArchitecture, SMS_G_System_OPERATING_SYSTEM.BuildNumber from
|
||||||
SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID =
|
SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID =
|
||||||
SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindOSArchSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindOSNameQuery |
|
$FindOSArchSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindOSNameQuery |
|
||||||
Select-Object -ExpandProperty OSArchitecture
|
Select-Object -ExpandProperty OSArchitecture
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM OS Build" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM OS Build" -PercentComplete (($i / 18) * 100)
|
||||||
$FindOSNameQuery = "select SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_OPERATING_SYSTEM.OSArchitecture, SMS_G_System_OPERATING_SYSTEM.BuildNumber from
|
$FindOSNameQuery = "select SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_OPERATING_SYSTEM.OSArchitecture, SMS_G_System_OPERATING_SYSTEM.BuildNumber from
|
||||||
SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID =
|
SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID =
|
||||||
SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindOSBuild = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindOSNameQuery |
|
$FindOSBuild = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindOSNameQuery |
|
||||||
Select-Object -ExpandProperty BuildNumber
|
Select-Object -ExpandProperty BuildNumber
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Encryption" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Encryption" -PercentComplete (($i / 18) * 100)
|
||||||
$FindEncryptionQuery = "select SMS_G_System_ENCRYPTABLE_VOLUME.ProtectionStatus from SMS_R_System inner join SMS_G_System_ENCRYPTABLE_VOLUME on
|
$FindEncryptionQuery = "select SMS_G_System_ENCRYPTABLE_VOLUME.ProtectionStatus from SMS_R_System inner join SMS_G_System_ENCRYPTABLE_VOLUME on
|
||||||
SMS_G_System_ENCRYPTABLE_VOLUME.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_ENCRYPTABLE_VOLUME.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindEncryptionSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindEncryptionQuery |
|
$FindEncryptionSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindEncryptionQuery |
|
||||||
Select-Object -ExpandProperty ProtectionStatus
|
Select-Object -ExpandProperty ProtectionStatus
|
||||||
Switch($FindEncryptionSCCM){
|
Switch($FindEncryptionSCCM){
|
||||||
|
|
@ -157,10 +171,10 @@ Function Get-SCCMQueryBlock {
|
||||||
Default{$FindEncryptionSCCM = "Encryption Not Found"}
|
Default{$FindEncryptionSCCM = "Encryption Not Found"}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Last Boot Up Time" $NumberofComputers $PCID
|
$i++
|
||||||
$FindLastBootUpTimeSCCM = Get-SCCMLastBootUpTime $comp
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Last Boot Up Time" -PercentComplete (($i / 18) * 100)
|
||||||
$FindLastBootUpTimeQuery = "select SMS_G_System_OPERATING_SYSTEM.LastBootUpTime from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on
|
$FindLastBootUpTimeQuery = "select SMS_G_System_OPERATING_SYSTEM.LastBootUpTime from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on
|
||||||
SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
|
|
||||||
$FindLastBootUpTimeSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindLastBootUpTimeQuery |
|
$FindLastBootUpTimeSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindLastBootUpTimeQuery |
|
||||||
Select-Object -ExpandProperty LastBootUpTime
|
Select-Object -ExpandProperty LastBootUpTime
|
||||||
|
|
@ -174,23 +188,29 @@ Function Get-SCCMQueryBlock {
|
||||||
$FindLastBootUpTimeSCCM = "$Month/$Day/$Year $Hour" + ":" + "$Minute" + ":" + "$Second"
|
$FindLastBootUpTimeSCCM = "$Month/$Day/$Year $Hour" + ":" + "$Minute" + ":" + "$Second"
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Printers" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Printers" -PercentComplete (($i / 18) * 100)
|
||||||
$FindPCPrinterQuery = "select SMS_G_System_PRINTER_DEVICE.Name, SMS_G_System_PRINTER_DEVICE.PortName from SMS_R_System inner join SMS_G_System_PRINTER_DEVICE
|
$FindPCPrinterQuery = "select SMS_G_System_PRINTER_DEVICE.Name, SMS_G_System_PRINTER_DEVICE.PortName from SMS_R_System inner join SMS_G_System_PRINTER_DEVICE
|
||||||
on SMS_G_System_PRINTER_DEVICE.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
on SMS_G_System_PRINTER_DEVICE.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Name = '$comp'"
|
||||||
$FindPCPrinterSCCM = (Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindPCPrinterQuery |
|
$FindPCPrinterSCCM = (Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindPCPrinterQuery |
|
||||||
Where-Object -Property PortName -ne nul: |
|
Where-Object -Property PortName -ne nul: |
|
||||||
Where-Object -Property PortName -ne PORTPROMPT: |
|
Where-Object -Property PortName -ne PORTPROMPT: |
|
||||||
Where-Object -Property PortName -ne SHRFAX: | Select-Object -ExpandProperty Name) -join ' || '
|
Where-Object -Property PortName -ne SHRFAX: | Select-Object -ExpandProperty Name) -join ' || '
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM MACAddress" $NumberofComputers $PCID
|
$i++
|
||||||
$FindMACAddressSCCM = Get-SCCMFindMACAddress $comp
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM MACAddress" -PercentComplete (($i / 18) * 100)
|
||||||
|
$FindMacAddressQuery = "select SMS_R_System.MACAddresses from SMS_R_System where SMS_R_System.Name = '$comp'"
|
||||||
|
$FindMacAddressSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindMacAddressQuery | Select-Object -ExpandProperty MACAddresses
|
||||||
|
$FindMacAddressSCCM = if($FindMacAddressSCCM.Count -gt 1){
|
||||||
|
$FindMacAddressSCCM[0]
|
||||||
|
}
|
||||||
|
|
||||||
$i++ | ProgressBar $i $comp "SCCM Chassis Type" $NumberofComputers $PCID
|
$i++
|
||||||
|
Write-Progress -Activity "Scanning PC $comp" -Status "SCCM Chassis Type" -PercentComplete (($i / 18) * 100)
|
||||||
$FindProcessorQuery = "select SMS_G_System_PROCESSOR.Name from SMS_R_System inner join SMS_G_System_PROCESSOR on SMS_G_System_PROCESSOR.ResourceId = SMS_R_System.ResourceId inner join SMS_G_System_SYSTEM on
|
$FindProcessorQuery = "select SMS_G_System_PROCESSOR.Name from SMS_R_System inner join SMS_G_System_PROCESSOR on SMS_G_System_PROCESSOR.ResourceId = SMS_R_System.ResourceId inner join SMS_G_System_SYSTEM on
|
||||||
SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name = '$ComputerName'"
|
SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name = '$comp'"
|
||||||
$FindProcessorSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindProcessorQuery | Select-Object -ExpandProperty Name
|
$FindProcessorSCCM = Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $FindProcessorQuery | Select-Object -ExpandProperty Name
|
||||||
$Model = Get-SCCMFindModelQuery $ComputerName
|
$FindChassisTypeSCCM = Switch -Wildcard($CompModelSCCM){
|
||||||
$FindChassisTypeSCCM = Switch -Wildcard($Model){
|
|
||||||
"Optiplex*" {
|
"Optiplex*" {
|
||||||
Switch -Wildcard($FindProcessorSCCM){
|
Switch -Wildcard($FindProcessorSCCM){
|
||||||
"Intel(R) Core(TM) i5-9500 CPU*" {"SFF"} #5070
|
"Intel(R) Core(TM) i5-9500 CPU*" {"SFF"} #5070
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#region Module Import Block
|
#region Module Import Block
|
||||||
|
|
||||||
$ErrorActionPreference = 'SilentlyContinue'
|
#$ErrorActionPreference = 'SilentlyContinue'
|
||||||
#DevStage can take either Dev or Prod as values
|
#DevStage can take either Dev or Prod as values
|
||||||
$devStage = 'Dev'
|
$devStage = 'Dev'
|
||||||
#Locations for dev build and prod build
|
#Locations for dev build and prod build
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
Patch: 2024-07-30
|
||||||
|
-Fix SCCM scans that broke in last update. Woopsie!
|
||||||
|
-Add stronger filters to AppDiff
|
||||||
|
|
||||||
Patch: 2024-07-26
|
Patch: 2024-07-26
|
||||||
-Refactors
|
-Refactors
|
||||||
-Update BatchInvokes to utilize jobs for up to 4x speedup
|
-Update BatchInvokes to utilize jobs for up to 4x speedup
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue