Get-pc wrapped logging and various get-pc local bugs
This commit is contained in:
parent
e30dfa2aaa
commit
1da8a5dd3d
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'Get-PC.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '0.4.4'
|
||||
ModuleVersion = '0.4.5'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ function Get-Hostname ([string]$name) {
|
|||
$cmdbMatches = Find-ISMBO -bo cis -SearchQuery $name
|
||||
if ($cmdbMatches -and $cmdbMatches.Count -lt 2) {
|
||||
return $cmdbMatches.Name,''
|
||||
}
|
||||
} elseif (!$cmdbMatches) { $errMsg += "No CMDB match found" }
|
||||
elseif ($cmdbMatches.Count -ge 2) { $errMsg += "Many CMDB matches found" }
|
||||
|
||||
return $name, $errMsg
|
||||
}
|
||||
|
|
@ -30,6 +30,8 @@
|
|||
$i++ | ProgressBar $i $comp "Asset Tag" $NumberofComputers $PCID
|
||||
$compAssetTag = Get-PCCompAssetTag $comp
|
||||
$i++ | ProgressBar $i $comp "Encryption" $NumberofComputers $PCID
|
||||
$hasBitLocker = Get-PCHasBitLocker $comp
|
||||
$i++ | ProgressBar $i $comp "OS Version" $NumberofComputers $PCID
|
||||
$compOSVersion = Get-PCCompOSVersion $comp
|
||||
$i++ | ProgressBar $i $comp "OS Architecture" $NumberofComputers $PCID
|
||||
$compArchitectureBuild = Get-PCCompArchitectureBuild $comp
|
||||
|
|
@ -39,7 +41,7 @@
|
|||
$driveType = Get-PCDriveType $comp
|
||||
$i++ | ProgressBar $i $comp "Citrix Version" $NumberofComputers $PCID
|
||||
$citrixVersion = Get-PCCitrixVersion $comp
|
||||
$i++ | ProgressBar $i $comp "CPU Type" $NumberofComputers $PCID
|
||||
$i++ | ProgressBar $i $comp "Chassis Type" $NumberofComputers $PCID
|
||||
$chassisType = Get-ChassisType $compCPU $compModel
|
||||
|
||||
$i++ | ProgressBar $i $comp " Local Last User" $NumberofComputers $PCID
|
||||
|
|
@ -54,17 +56,12 @@
|
|||
$releaseID = PCReleaseIDLocal
|
||||
$i++ | ProgressBar $i $comp "Local Printers" $NumberofComputers $PCID
|
||||
$getPrinter = Get-PCPrinterLocal
|
||||
$i++ | ProgressBar $i $comp "Time Stamp" $NumberofComputers $PCID
|
||||
#$i++ | ProgressBar $i $comp "Time Stamp" $NumberofComputers $PCID
|
||||
#$lastUserTimeStamp = Get-PCLastUserTimestampLocal
|
||||
$i++ | ProgressBar $i $comp "GPO Status" $NumberofComputers $PCID
|
||||
$getGPOStatus = Get-GPOStatusLocal
|
||||
$i++ | ProgressBar $i $comp "TPM Status" $NumberofComputers $PCID
|
||||
$tpmStatus = Get-TPMStatusLocal
|
||||
$i++ | ProgressBar $i $comp "Checking Bitlocker" $NumberofComputers $PCID
|
||||
$hasBitLocker = Get-PCHasBitLockerLocal
|
||||
|
||||
$i++ | ProgressBar $i $comp "ChassisType" $NumberofComputers $PCID
|
||||
$chassisType = Get-ChassisType $compCPU $compModel
|
||||
|
||||
if($lastUser.Count -gt 1){
|
||||
|
||||
|
|
@ -125,13 +122,7 @@
|
|||
$compFreeSpaceGB = "$compFreeSpaceGB" + ' GB'
|
||||
$compMemory = "$compMemory" + ' GB'
|
||||
|
||||
if (Get-SparkEnabled) {
|
||||
$cmdbData = Get-SparkCI $ENV:ComputerName
|
||||
$locationData = $cmdbData.SHS_Floor + ' - ' + $cmdbData.SHS_Department + ' - ' + $cmdbData.SHS_LocationDetails
|
||||
if($cmdbData.SHS_IsException -eq 'True'){
|
||||
$delInfo = Get-CMDBDELInfo $cmdbData
|
||||
}
|
||||
}
|
||||
$locationData = Get-LocationDetails $comp
|
||||
|
||||
$i++ | ProgressBar $i $comp "Generating Output" $NumberofComputers $PCID
|
||||
|
||||
|
|
@ -158,6 +149,7 @@
|
|||
'TPM Status' = "$tpmStatus"
|
||||
'MBAM GPO' = "$getGPOStatus"
|
||||
Printers = "$getPrinter"
|
||||
'CMDB Location' = $locationData
|
||||
}
|
||||
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
$compModel = Get-PCCompModel $comp
|
||||
$i++ | ProgressBar $i $comp "RAM Size" $NumberofComputers $PCID
|
||||
$compMemory = Get-PCCompMemory $comp
|
||||
$i++ | ProgressBar $i $comp "CPU Type" $NumberofComputers $PCID
|
||||
$compCPU = Get-CPUType $comp
|
||||
$i++ | ProgressBar $i $comp "HDD/SSD Space" $NumberofComputers $PCID
|
||||
$compFreeSpace = Get-PCCompFreeSpace $comp
|
||||
$i++ | ProgressBar $i $comp "Service Tag" $NumberofComputers $PCID
|
||||
|
|
@ -40,8 +42,6 @@
|
|||
$driveType = Get-PCDriveType $comp
|
||||
$i++ | ProgressBar $i $comp "Citrix Version" $NumberofComputers $PCID
|
||||
$citrixVersion = Get-PCCitrixVersion $comp
|
||||
$i++ | ProgressBar $i $comp "CPU Type" $NumberofComputers $PCID
|
||||
$compCPU = Get-CPUType $comp
|
||||
$i++ | ProgressBar $i $comp "Chassis Type" $NumberofComputers $PCID
|
||||
$chassisType = Get-ChassisType $compCPU $compModel
|
||||
|
||||
|
|
@ -131,6 +131,8 @@
|
|||
$compFreeSpaceGB = "$compFreeSpaceGB" + ' GB'
|
||||
$compMemory = "$compMemory" + ' GB'
|
||||
|
||||
$locationData = Get-LocationDetails $comp
|
||||
|
||||
$i++ | ProgressBar $i $comp "Generating Output" $NumberofComputers $PCID
|
||||
|
||||
$props = [Ordered]@{
|
||||
|
|
@ -156,6 +158,7 @@
|
|||
'TPM Status' = "$tpmStatus"
|
||||
'MBAM GPO' = "$getGPOStatus"
|
||||
Printers = "$getPrinter"
|
||||
'CMDB Location' = $locationData
|
||||
}
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
||||
|
|
@ -558,3 +561,29 @@ Function Get-TimeOutJob ($Command){
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
Function Get-LocationDetails ($ComputerName) {
|
||||
|
||||
$cmdbRecord = Search-ISMBO -BO cis -filter "Name eq '$ComputerName'" -RawFilter
|
||||
|
||||
$LocationConstructors = @(
|
||||
"SHS_AssetLocality",
|
||||
"ivnt_Location",
|
||||
"SHS_Floor",
|
||||
"SHS_Department",
|
||||
"SHS_LocationDetails"
|
||||
)
|
||||
|
||||
$LocationData = Foreach($Loc in $LocationConstructors){
|
||||
|
||||
if ($Loc -eq 'SHS_Floor'){
|
||||
$(if ($cmdbRecord.$Loc -match '-'){$cmdbRecord.$Loc.split('-')[-1] + " Floor"} else{$cmdbRecord.$Loc})
|
||||
} elseif (![string]::IsNullOrEmpty($cmdbRecord.$Loc)){
|
||||
$cmdbRecord.$Loc
|
||||
}
|
||||
}
|
||||
|
||||
$LocationData = $LocationData -join ' | '
|
||||
|
||||
return $LocationData
|
||||
}
|
||||
|
|
@ -54,36 +54,36 @@ Function Get-SCCMQuery {
|
|||
|
||||
return $obj
|
||||
}
|
||||
$i++ | ProgressBar $i $comp "Last User SCCM" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "Last User SCCM" $NumberofComputers $PCID
|
||||
$LastUserSCCM = Get-SCCMLastUserLogOnQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM IP Query" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM IP Query" $NumberofComputers $PCID
|
||||
$FindIPSCCM = Get-SCCMIPQuery $comp
|
||||
$i++ | ProgressBar $i $comp "Find Model SCCM" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "Find Model SCCM" $NumberofComputers $PCID
|
||||
$CompModelSCCM = Get-SCCMFindModelQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Bios Version" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM Bios Version" $NumberofComputers $PCID
|
||||
$FindBiosVerSCCM = Get-SCCMBiosVerQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM HDD/SSD Space" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM HDD/SSD Space" $NumberofComputers $PCID
|
||||
$CompFreeSpaceSCCMGB = Get-SCCMFindFreeSpaceQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM RAM" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM RAM" $NumberofComputers $PCID
|
||||
$FindMemorySCCMGB = Get-SCCMFindMemoryQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Asset Tag" $NumberofComputers $PCID
|
||||
$FindAssetTagSCCM = Get-SCCMFindAssetTagQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Service Tag" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM Service Tag" $NumberofComputers $PCID
|
||||
$FindServiceTagSCCM = Get-SCCMServiceTagQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM OS Name" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM OS Name" $NumberofComputers $PCID
|
||||
$FindOSNameSCCM = Get-SCCMFindOSNameQuery $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM OS Architecture" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM OS Architecture" $NumberofComputers $PCID
|
||||
$FindOSArchSCCM = Get-SCCMFindOSArch $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM OS Build" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM OS Build" $NumberofComputers $PCID
|
||||
$FindOSBuild = Get-SCCMFindOSBuild $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Encryption" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM Encryption" $NumberofComputers $PCID
|
||||
$FindEncryptionSCCM = Get-SCCMFindEncryption $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Last Boot Up Time" $NumberofComputers $PCID
|
||||
$FindLastBootUpTimeSCCM = Get-SCCMLastBootUpTime $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Printers" $NumberofComputers $PCID
|
||||
$FindPCPrinterSCCM = Get-SCCMPCPrinter $comp
|
||||
|
||||
$i++ | ProgressBar $i $comp "SCCM MACAddress" $NumberofComputers $PCID
|
||||
$i++; i++ | ProgressBar $i $comp "SCCM MACAddress" $NumberofComputers $PCID
|
||||
$FindMACAddressSCCM = Get-SCCMFindMACAddress $comp
|
||||
$i++ | ProgressBar $i $comp "SCCM Chassis Type" $NumberofComputers $PCID
|
||||
$FindChassisTypeSCCM = Get-SCCMChassisType($comp)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#region Module Import Block
|
||||
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
#$ErrorActionPreference = 'SilentlyContinue'
|
||||
#DevStage can take either Dev or Prod as values
|
||||
$devStage = 'Dev'
|
||||
#Locations for dev build and prod build
|
||||
|
|
@ -128,7 +128,6 @@ Function Get-PC {
|
|||
[Switch]$WinProfileRebuild
|
||||
)
|
||||
|
||||
<#
|
||||
#Data collection for Get-PC Wrapped TM
|
||||
$invokeData = @{
|
||||
Hostname = $env:COMPUTERNAME
|
||||
|
|
@ -137,7 +136,6 @@ Function Get-PC {
|
|||
Parameters = $MyInvocation.BoundParameters
|
||||
}
|
||||
Add-Content -Path $getPCWrappedPath -Value $(ConvertTo-Json -Compress $invokeData)
|
||||
#>
|
||||
|
||||
## Define which Spark Record Properties are Returned
|
||||
$Spark_Property_Return = @(
|
||||
|
|
@ -670,5 +668,5 @@ Function Get-PC {
|
|||
}
|
||||
|
||||
Function ProgressBar($Percent, $CurrentPC, $CurrentLocationText, $NumberofComputers, $CurrentPCNumber) {
|
||||
Write-Progress -Activity "Scanning PC $CurrentPC ($CurrentPCNumber/$NumberofComputers)" -Status "Querying: $CurrentLocationText" -PercentComplete (($Percent / 18) * 100)
|
||||
Write-Progress -Activity "Scanning PC $CurrentPC ($CurrentPCNumber/$NumberofComputers)" -Status "Querying: $CurrentLocationText" -PercentComplete (($Percent / 29) * 100)
|
||||
}
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
Patch: 2024-09-04
|
||||
-Add Logging for GetPCWrapped
|
||||
-Fix Ambiguous CMDB results now report error message
|
||||
-Add CMDB Location to get-pc local
|
||||
-Fix Progress Bar bug with get-pc local
|
||||
|
||||
Patch: 2024-08-29
|
||||
-Add CMDB flag to just query CMDB for fields
|
||||
-Fix bug in CMDB Fallback not reporting RAM correctly
|
||||
|
|
|
|||
Loading…
Reference in a new issue