Compare commits
No commits in common. "54ba4e28a518962674955b82baae272746accb40" and "97cd6b84fd3a404fbf367efa09d396029baf132c" have entirely different histories.
54ba4e28a5
...
97cd6b84fd
|
|
@ -9,13 +9,13 @@
|
||||||
<TableControl>
|
<TableControl>
|
||||||
<TableHeaders>
|
<TableHeaders>
|
||||||
<TableColumnHeader>
|
<TableColumnHeader>
|
||||||
<Width>40</Width>
|
|
||||||
</TableColumnHeader>
|
</TableColumnHeader>
|
||||||
<TableColumnHeader>
|
<TableColumnHeader>
|
||||||
<Width>30</Width>
|
|
||||||
</TableColumnHeader>
|
</TableColumnHeader>
|
||||||
<TableColumnHeader>
|
<TableColumnHeader>
|
||||||
<Width>25</Width>
|
<Width>10</Width>
|
||||||
</TableColumnHeader>
|
</TableColumnHeader>
|
||||||
<TableColumnHeader>
|
<TableColumnHeader>
|
||||||
<Width>15</Width>
|
<Width>15</Width>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
RootModule = 'Get-PC.psm1'
|
RootModule = 'Get-PC.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '0.4.23'
|
ModuleVersion = '0.4.21'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ function Get-AppDiff {
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Filtering out standard apps from $pc" -Status "Checking $app" -PercentComplete (($appi * 90 / $apps.Length) + 10) -ParentId 1
|
Write-Progress -Activity "Filtering out standard apps from $pc" -Status "Checking $app" -PercentComplete (($appi * 90 / $apps.Length) + 10) -ParentId 1
|
||||||
|
|
||||||
if ($output.Length -eq 0) { Write-Warning "No non-standard apps found on $pc" }
|
if ($output.Length -eq 0) { Write-Warning "No non-standard apps found" }
|
||||||
|
|
||||||
if($TableView){
|
if($TableView){
|
||||||
$output | Out-GridView -Title "Get-PC Apps - $pc"
|
$output | Out-GridView -Title "Get-PC Apps - $pc"
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,7 @@ Function Get-Apps($ComputerName, $CompStatus, $TableView) {
|
||||||
} else {
|
} else {
|
||||||
Write-Progress -Activity "Getting apps for $ComputerName" -Status 'Querying SCCM apps' -PercentComplete 10 -ParentId 1
|
Write-Progress -Activity "Getting apps for $ComputerName" -Status 'Querying SCCM apps' -PercentComplete 10 -ParentId 1
|
||||||
$86apps, $64apps = Get-SCCM_Apps $ComputerName
|
$86apps, $64apps = Get-SCCM_Apps $ComputerName
|
||||||
$apps = ($86apps + $64apps) | Select-Object *,@{N='DisplayVersion';E={$_.Version}} |
|
$apps = ($86apps + $64apps) | Sort-Object 'x86/x64',DisplayName -Unique | ForEach-Object { $_.PSObject.TypeNames.Insert(0, 'GetPC.App'); $_ }
|
||||||
Sort-Object 'x86/x64',DisplayName -Unique | ForEach-Object { $_.PSObject.TypeNames.Insert(0, 'GetPC.App'); $_ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,13 @@
|
||||||
function Invoke-EnableComputer ($comp) {
|
function Invoke-EnableComputer ($comp) {
|
||||||
# This if statement attempts to place a workstation at a location. Workstations
|
$site = switch -Regex ($comp) {
|
||||||
# that don't follow the old naming scheme with site indicators are just placed in
|
'^A' {'SAGH'}
|
||||||
# the Samaritan Workstations OU. We could query to see if they are online and use
|
'^L' {'SLCH'}
|
||||||
# the DNS servers to determine what site they are at, but that's too much trouble
|
'^S' {'SNLH'}
|
||||||
# for now
|
'^P' {'SPCH'}
|
||||||
$site = if ($comp -match "^([WL][0-9]{5})|(PACS)") { $null } else {
|
'^G(AV|CN|WN)' {'Avery'}
|
||||||
switch -Regex ($comp) {
|
default {'GSRMC'}
|
||||||
'^A' {'SAGH'}
|
}
|
||||||
'^L' {'SLCH'}
|
$comp | Get-ADComputer | Enable-ADAccount -PassThru | Move-ADObject -TargetPath "OU=$site,OU=Samaritan Workstations,DC=int,DC=samhealth,DC=net"
|
||||||
'^S' {'SNLH'}
|
|
||||||
'^P' {'SPCH'}
|
|
||||||
'^G(AV|CN|WN)' {'Avery'}
|
|
||||||
'^G(?!AV|CN|WN)' {'GSRMC'}
|
|
||||||
default {$null}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($null -eq $site) {
|
|
||||||
$comp | Get-ADComputer | Enable-ADAccount -PassThru | Move-ADObject -TargetPath "OU=Samaritan Workstations,DC=int,DC=samhealth,DC=net"
|
|
||||||
} else {
|
|
||||||
$comp | Get-ADComputer | Enable-ADAccount -PassThru | Move-ADObject -TargetPath "OU=$site,OU=Samaritan Workstations,DC=int,DC=samhealth,DC=net"
|
|
||||||
}
|
|
||||||
if (Get-ADUser -Filter "Name -like 'K_$comp'") {
|
if (Get-ADUser -Filter "Name -like 'K_$comp'") {
|
||||||
Write-Host -ForegroundColor Yellow "Kiosk account found. Please re-submit a kiosk request and re-kiosk $comp."
|
Write-Host -ForegroundColor Yellow "Kiosk account found. Please re-submit a kiosk request and re-kiosk $comp."
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -311,14 +311,7 @@
|
||||||
|
|
||||||
$timeout = if ($SparkQueryTimeoutSec) {$SparkQueryTimeoutSec} else {5}
|
$timeout = if ($SparkQueryTimeoutSec) {$SparkQueryTimeoutSec} else {5}
|
||||||
Write-Progress -Activity "Retrieving data from $Env:COMPUTERNAME" -Status "Querying Spark! for location details. Timeout $($timeout)s" -PercentComplete 95
|
Write-Progress -Activity "Retrieving data from $Env:COMPUTERNAME" -Status "Querying Spark! for location details. Timeout $($timeout)s" -PercentComplete 95
|
||||||
$uri = if ($assetTag -ne '') {
|
$uri = "$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$assetTag'&`$top=1&`$skip=0"
|
||||||
"$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$assetTag'"
|
|
||||||
} elseif ($serviceTag -ne ''){
|
|
||||||
"$Tenant/api/odata/businessobject/cis`?`$filter=SerialNumber eq '$serviceTag'"
|
|
||||||
} else {
|
|
||||||
"$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$env:ComputerName'&`$top=1&`$skip=0"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
||||||
if ($Query) {
|
if ($Query) {
|
||||||
|
|
|
||||||
|
|
@ -219,13 +219,7 @@ $Headers = @{
|
||||||
Write-Progress -Activity "Getting SCCM data for $comp" -Status 'Querying for CMDB data' -PercentComplete $progress -ParentID 0 -Id $PCID
|
Write-Progress -Activity "Getting SCCM data for $comp" -Status 'Querying for CMDB data' -PercentComplete $progress -ParentID 0 -Id $PCID
|
||||||
|
|
||||||
$timeout = if ($SparkQueryTimeoutSec) {$SparkQueryTimeoutSec} else {5}
|
$timeout = if ($SparkQueryTimeoutSec) {$SparkQueryTimeoutSec} else {5}
|
||||||
$uri = if ($assetTag -ne '') {
|
$uri = "$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$comp'&`$top=1&`$skip=0"
|
||||||
"$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$assetTag'"
|
|
||||||
} elseif ($serviceTag -ne ''){
|
|
||||||
"$Tenant/api/odata/businessobject/cis`?`$filter=SerialNumber eq '$serviceTag'"
|
|
||||||
} else {
|
|
||||||
"$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$env:ComputerName'&`$top=1&`$skip=0"
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
||||||
if ($Query) {
|
if ($Query) {
|
||||||
|
|
|
||||||
|
|
@ -193,52 +193,32 @@ $Headers = @{
|
||||||
try { $name = $snmp.Get('.1.3.6.1.4.1.10642.1.4.0').toupper() } catch { $name = $null }
|
try { $name = $snmp.Get('.1.3.6.1.4.1.10642.1.4.0').toupper() } catch { $name = $null }
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for model' -PercentComplete 30 -ParentId 2
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for model' -PercentComplete 30 -ParentId 2
|
||||||
try { $model = $snmp.Get('.1.3.6.1.4.1.10642.200.19.7.0').toupper() } catch { $model = $null }
|
try { $model = $snmp.Get('.1.3.6.1.4.1.10642.200.19.7.0').toupper() } catch { $model = $null }
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for adapter type' -PercentComplete 40 -ParentId 2
|
|
||||||
try { $adapter = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.5.2.1.5.3') } catch { $adapter = $null }
|
|
||||||
$adapterType = switch ($adapter) {
|
|
||||||
1 { '(Ethernet)' }
|
|
||||||
2 { '(WiFi)' }
|
|
||||||
default { $null }
|
|
||||||
}
|
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for MAC address' -PercentComplete 50 -ParentId 2
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for MAC address' -PercentComplete 50 -ParentId 2
|
||||||
$MAC = switch ($adapter) {
|
try { $MAC = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.10.2.1.5.2').toupper() } catch { $MAC = $null }
|
||||||
2 { try { $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.5.2.1.2.3') } catch { $null } }
|
|
||||||
default { try { $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.5.2.1.2.2') } catch { $null } }
|
|
||||||
}
|
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for serial number' -PercentComplete 70 -ParentId 2
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for serial number' -PercentComplete 70 -ParentId 2
|
||||||
try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.1.9.0') } catch { $serial = $null }
|
try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.200.19.5.0') } catch { $serial = $null }
|
||||||
if (!$serial) { try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.200.19.5.0') } catch { $serial = $null } }
|
|
||||||
# try { $status = $snmp.Get('.1.3.6.1.4.1.10642.200.4.1.0') } catch { $status = $null }
|
# try { $status = $snmp.Get('.1.3.6.1.4.1.10642.200.4.1.0') } catch { $status = $null }
|
||||||
|
# Zebra GK420
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode' -PercentComplete 80 -ParentId 2
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode' -PercentComplete 80 -ParentId 2
|
||||||
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null }
|
try { $ipconfig = "($($snmp.Get('.1.3.6.1.4.1.10642.200.50.1.1.5.0')))" } catch { $ipconfig = $null }
|
||||||
$ipconfig = switch ($ipconfig) {
|
# Zebra ZD421
|
||||||
1 {'(All)'}
|
if (!$ipconfig) {
|
||||||
2 {'(GLEANING ONLY)'}
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode (2nd attempt)' -PercentComplete 85 -ParentId 2
|
||||||
3 {'(RARP)'}
|
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null }
|
||||||
4 {'(BOOTP)'}
|
$ipconfig = switch ($ipconfig) {
|
||||||
5 {'(DHCP)'}
|
1 {'(All)'}
|
||||||
6 {'(DHCP AND BOOTP)'}
|
2 {'(GLEANING ONLY)'}
|
||||||
7 {'(PERMANENT)'}
|
3 {'(RARP)'}
|
||||||
default {'(UNKNOWN)'}
|
4 {'(BOOTP)'}
|
||||||
|
5 {'(DHCP)'}
|
||||||
|
6 {'(DHCP AND BOOTP)'}
|
||||||
|
7 {'(PERMANENT)'}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<# These settings seem to vary wildly in OID between models
|
|
||||||
$sensorType = try { $snmp.Get('.1.3.6.1.4.1.10642.2.851.1.4.3.0') } catch { 0 }
|
|
||||||
$sensorType = switch ($sensorType) {
|
|
||||||
0 {'WEB'}
|
|
||||||
1 {'MARK'}
|
|
||||||
default {'UNKNOWN'}
|
|
||||||
}
|
|
||||||
$mediaType = try { $snmp.Get('.1.3.6.1.4.1.10642.2.851.1.4.4.0') } catch { 1 }
|
|
||||||
$mediaType = switch ($mediaType) {
|
|
||||||
0 {'CONTINUOUS'}
|
|
||||||
1 {'NON-CONTINUOUS'}
|
|
||||||
default {'UNKNOWN'}
|
|
||||||
}
|
|
||||||
#>
|
|
||||||
$model = "Zebra $model"
|
$model = "Zebra $model"
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2
|
||||||
#STATUS
|
#STATUS
|
||||||
$uri = "http://$printerip"
|
$uri = $domainName
|
||||||
$html = Invoke-WebRequest -uri $uri
|
$html = Invoke-WebRequest -uri $uri
|
||||||
$raw = $html.rawcontent
|
$raw = $html.rawcontent
|
||||||
$raw -match '([A-Z])\w+<.F' | Out-Null
|
$raw -match '([A-Z])\w+<.F' | Out-Null
|
||||||
|
|
@ -410,7 +390,7 @@ $Headers = @{
|
||||||
Status = $status
|
Status = $status
|
||||||
IP = "$printerip $ipconfig"
|
IP = "$printerip $ipconfig"
|
||||||
DomainName = $domainName
|
DomainName = $domainName
|
||||||
MAC = "$MAC $adapterType"
|
MAC = $MAC
|
||||||
Model = $model
|
Model = $model
|
||||||
Serial = $serial
|
Serial = $serial
|
||||||
#Comment = $comment
|
#Comment = $comment
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@ function Invoke-UninstallProgram ($Computer) {
|
||||||
Write-Host "Uninstalling $($apps[$item].Name)"
|
Write-Host "Uninstalling $($apps[$item].Name)"
|
||||||
$res = $apps[$item].Uninstall()
|
$res = $apps[$item].Uninstall()
|
||||||
switch ($res.ReturnValue) {
|
switch ($res.ReturnValue) {
|
||||||
0 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName" }
|
0 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer" }
|
||||||
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Restarting $env:ComputerName" }
|
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Restarting $Computer" }
|
||||||
3010 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Please restart $env:ComputerName to finish uninstall" }
|
3010 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Please restart $Computer to finish uninstall" }
|
||||||
3011 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Please restart $env:ComputerName to finish uninstall" }
|
3011 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Please restart $Computer to finish uninstall" }
|
||||||
default { Write-Warning "$($apps[$item].Name) failed to uninstall from $env:ComputerName with ReturnValue $($res.ReturnValue). See an MsiExec return value table for more information." }
|
default { Write-Warning "$appname failed to uninstall from $Computer with ReturnValue $($res.ReturnValue). See an MsiExec return value table for more information." }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
Get-Item -Path "$Source\*" -Exclude ('Teams') | ForEach-Object {
|
Get-Item -Path "$Source\*" -Exclude ('Teams') | ForEach-Object {
|
||||||
$tmpDst = Join-Path $Destination $_.Name
|
$tmpDst = Join-Path $Destination $_.Name
|
||||||
if( -not ( Test-Path -Path $tmpDst -PathType Container ) ){
|
if( -not ( Test-Path -Path $tmpDst -PathType Container ) ){
|
||||||
New-Item "$tmpDst" -ItemType Container | Write-Verbose
|
New-Item "$tmpDst" -ItemType Container
|
||||||
}
|
}
|
||||||
Copy-Directory $_ $tmpDst -ProgressBarIndex 1 | Out-File $log -Append
|
Copy-Directory $_ $tmpDst -ProgressBarIndex 1 | Out-File $log -Append
|
||||||
}
|
}
|
||||||
|
|
@ -108,8 +108,8 @@ function Copy-Directory {
|
||||||
Get-ChildItem -Recurse $SourceDir | ForEach-Object { $TotalLength += $_.Length }
|
Get-ChildItem -Recurse $SourceDir | ForEach-Object { $TotalLength += $_.Length }
|
||||||
$ProgressLength = 0
|
$ProgressLength = 0
|
||||||
Get-ChildItem $SourceDir | ForEach-Object {
|
Get-ChildItem $SourceDir | ForEach-Object {
|
||||||
|
Write-Progress -Activity "Copying Directory" -Status "$SourceDir to $DestDir" -Id $ProgressBarIndex -PercentComplete $($ProgressLength*100/$TotalLength)
|
||||||
$item = $_
|
$item = $_
|
||||||
Write-Progress -Activity "Copying Directory $SourceDir to $DestDir" -Status "$item" -Id $ProgressBarIndex -PercentComplete $($ProgressLength*100/$TotalLength)
|
|
||||||
$DestDirPath = Join-Path $DestDir $item.Name
|
$DestDirPath = Join-Path $DestDir $item.Name
|
||||||
switch -Regex ($item.Mode) {
|
switch -Regex ($item.Mode) {
|
||||||
'd-----' {
|
'd-----' {
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,7 @@
|
||||||
Patch
|
Patch
|
||||||
-Fix Zebra printer statuses report correctly now
|
|
||||||
-Fix ZD421 printers report Serial numbers correctly
|
|
||||||
-Update Enable now defualts workstations to the Samaritan Workstations OU rather than GSRMC
|
|
||||||
-Update Enable detects L12345 and PACS12345 and places them in the default rather than NLH and PCH OUs
|
|
||||||
-Fix UninstallProgram reports the hostname in the done message rather than blank
|
|
||||||
-Update Zebra printers report Ethernet or wifi. Detection method isn't officially documented by Zebra so could be faulty
|
|
||||||
-Fix PCLocal searches CMDB with the first non-null value in Asset Tag, Serial Number, and Name
|
|
||||||
-Fix UninstallProgram reports app name in warning message
|
|
||||||
|
|
||||||
Patch 2025-5-28
|
|
||||||
-Update SCCMQueryBlock uses asset tag to query Spark!
|
|
||||||
-Fix SCCM apps report version correctly
|
|
||||||
-Update Apps only display the first 40 characters of a name so output fits better
|
|
||||||
|
|
||||||
Patch 2025-5-6
|
|
||||||
-Update Custom SHSApps have more robust detection
|
-Update Custom SHSApps have more robust detection
|
||||||
-Fix SCCM queries return mac address correctly
|
-Fix SCCM queries return mac address correctly
|
||||||
-Add UserProfileBackup has progress bars!
|
-Update UserProfileBackup has progress bars!
|
||||||
-Update UserProfileBackup doesn't copy Sticky Notes anymore
|
-Update UserProfileBackup doesn't copy Sticky Notes anymore
|
||||||
-Update UserProfileBackup reports fewer non-critical errors
|
-Update UserProfileBackup reports fewer non-critical errors
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue