Compare commits
10 commits
97cd6b84fd
...
54ba4e28a5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54ba4e28a5 | ||
|
|
d2e224cd69 | ||
|
|
9649f47b8a | ||
|
|
920949721f | ||
|
|
05d25b3033 | ||
|
|
487ed24fa3 | ||
|
|
7c451bb82c | ||
|
|
42455ff903 | ||
|
|
78efcd863f | ||
|
|
d5821e17a5 |
|
|
@ -9,13 +9,13 @@
|
|||
<TableControl>
|
||||
<TableHeaders>
|
||||
<TableColumnHeader>
|
||||
|
||||
<Width>40</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
|
||||
<Width>30</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>10</Width>
|
||||
<Width>25</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>15</Width>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'Get-PC.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '0.4.21'
|
||||
ModuleVersion = '0.4.23'
|
||||
|
||||
# Supported PSEditions
|
||||
# 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
|
||||
|
||||
if ($output.Length -eq 0) { Write-Warning "No non-standard apps found" }
|
||||
if ($output.Length -eq 0) { Write-Warning "No non-standard apps found on $pc" }
|
||||
|
||||
if($TableView){
|
||||
$output | Out-GridView -Title "Get-PC Apps - $pc"
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ Function Get-Apps($ComputerName, $CompStatus, $TableView) {
|
|||
} else {
|
||||
Write-Progress -Activity "Getting apps for $ComputerName" -Status 'Querying SCCM apps' -PercentComplete 10 -ParentId 1
|
||||
$86apps, $64apps = Get-SCCM_Apps $ComputerName
|
||||
$apps = ($86apps + $64apps) | Sort-Object 'x86/x64',DisplayName -Unique | ForEach-Object { $_.PSObject.TypeNames.Insert(0, 'GetPC.App'); $_ }
|
||||
$apps = ($86apps + $64apps) | Select-Object *,@{N='DisplayVersion';E={$_.Version}} |
|
||||
Sort-Object 'x86/x64',DisplayName -Unique | ForEach-Object { $_.PSObject.TypeNames.Insert(0, 'GetPC.App'); $_ }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,25 @@
|
|||
function Invoke-EnableComputer ($comp) {
|
||||
$site = switch -Regex ($comp) {
|
||||
'^A' {'SAGH'}
|
||||
'^L' {'SLCH'}
|
||||
'^S' {'SNLH'}
|
||||
'^P' {'SPCH'}
|
||||
'^G(AV|CN|WN)' {'Avery'}
|
||||
default {'GSRMC'}
|
||||
}
|
||||
$comp | Get-ADComputer | Enable-ADAccount -PassThru | Move-ADObject -TargetPath "OU=$site,OU=Samaritan Workstations,DC=int,DC=samhealth,DC=net"
|
||||
# This if statement attempts to place a workstation at a location. Workstations
|
||||
# that don't follow the old naming scheme with site indicators are just placed in
|
||||
# the Samaritan Workstations OU. We could query to see if they are online and use
|
||||
# the DNS servers to determine what site they are at, but that's too much trouble
|
||||
# for now
|
||||
$site = if ($comp -match "^([WL][0-9]{5})|(PACS)") { $null } else {
|
||||
switch -Regex ($comp) {
|
||||
'^A' {'SAGH'}
|
||||
'^L' {'SLCH'}
|
||||
'^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'") {
|
||||
Write-Host -ForegroundColor Yellow "Kiosk account found. Please re-submit a kiosk request and re-kiosk $comp."
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -311,7 +311,14 @@
|
|||
|
||||
$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
|
||||
$uri = "$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$assetTag'&`$top=1&`$skip=0"
|
||||
$uri = if ($assetTag -ne '') {
|
||||
"$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 {
|
||||
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
||||
if ($Query) {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,13 @@ $Headers = @{
|
|||
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}
|
||||
$uri = "$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$comp'&`$top=1&`$skip=0"
|
||||
$uri = if ($assetTag -ne '') {
|
||||
"$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 {
|
||||
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
||||
if ($Query) {
|
||||
|
|
|
|||
|
|
@ -193,32 +193,52 @@ $Headers = @{
|
|||
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
|
||||
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 MAC address' -PercentComplete 50 -ParentId 2
|
||||
try { $MAC = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.10.2.1.5.2').toupper() } catch { $MAC = $null }
|
||||
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.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 }
|
||||
# Zebra GK420
|
||||
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.200.50.1.1.5.0')))" } catch { $ipconfig = $null }
|
||||
# Zebra ZD421
|
||||
if (!$ipconfig) {
|
||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode (2nd attempt)' -PercentComplete 85 -ParentId 2
|
||||
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null }
|
||||
$ipconfig = switch ($ipconfig) {
|
||||
1 {'(All)'}
|
||||
2 {'(GLEANING ONLY)'}
|
||||
3 {'(RARP)'}
|
||||
4 {'(BOOTP)'}
|
||||
5 {'(DHCP)'}
|
||||
6 {'(DHCP AND BOOTP)'}
|
||||
7 {'(PERMANENT)'}
|
||||
}
|
||||
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
|
||||
$MAC = switch ($adapter) {
|
||||
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
|
||||
try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.1.9.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 }
|
||||
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 }
|
||||
$ipconfig = switch ($ipconfig) {
|
||||
1 {'(All)'}
|
||||
2 {'(GLEANING ONLY)'}
|
||||
3 {'(RARP)'}
|
||||
4 {'(BOOTP)'}
|
||||
5 {'(DHCP)'}
|
||||
6 {'(DHCP AND BOOTP)'}
|
||||
7 {'(PERMANENT)'}
|
||||
default {'(UNKNOWN)'}
|
||||
}
|
||||
<# 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"
|
||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2
|
||||
#STATUS
|
||||
$uri = $domainName
|
||||
$uri = "http://$printerip"
|
||||
$html = Invoke-WebRequest -uri $uri
|
||||
$raw = $html.rawcontent
|
||||
$raw -match '([A-Z])\w+<.F' | Out-Null
|
||||
|
|
@ -390,7 +410,7 @@ $Headers = @{
|
|||
Status = $status
|
||||
IP = "$printerip $ipconfig"
|
||||
DomainName = $domainName
|
||||
MAC = $MAC
|
||||
MAC = "$MAC $adapterType"
|
||||
Model = $model
|
||||
Serial = $serial
|
||||
#Comment = $comment
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ function Invoke-UninstallProgram ($Computer) {
|
|||
Write-Host "Uninstalling $($apps[$item].Name)"
|
||||
$res = $apps[$item].Uninstall()
|
||||
switch ($res.ReturnValue) {
|
||||
0 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer" }
|
||||
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Restarting $Computer" }
|
||||
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 $Computer"; Write-Warning "Please restart $Computer to finish uninstall" }
|
||||
default { Write-Warning "$appname failed to uninstall from $Computer with ReturnValue $($res.ReturnValue). See an MsiExec return value table for more information." }
|
||||
0 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName" }
|
||||
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Restarting $env:ComputerName" }
|
||||
3010 { 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 $env:ComputerName"; Write-Warning "Please restart $env:ComputerName 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." }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
Get-Item -Path "$Source\*" -Exclude ('Teams') | ForEach-Object {
|
||||
$tmpDst = Join-Path $Destination $_.Name
|
||||
if( -not ( Test-Path -Path $tmpDst -PathType Container ) ){
|
||||
New-Item "$tmpDst" -ItemType Container
|
||||
New-Item "$tmpDst" -ItemType Container | Write-Verbose
|
||||
}
|
||||
Copy-Directory $_ $tmpDst -ProgressBarIndex 1 | Out-File $log -Append
|
||||
}
|
||||
|
|
@ -108,8 +108,8 @@ function Copy-Directory {
|
|||
Get-ChildItem -Recurse $SourceDir | ForEach-Object { $TotalLength += $_.Length }
|
||||
$ProgressLength = 0
|
||||
Get-ChildItem $SourceDir | ForEach-Object {
|
||||
Write-Progress -Activity "Copying Directory" -Status "$SourceDir to $DestDir" -Id $ProgressBarIndex -PercentComplete $($ProgressLength*100/$TotalLength)
|
||||
$item = $_
|
||||
Write-Progress -Activity "Copying Directory $SourceDir to $DestDir" -Status "$item" -Id $ProgressBarIndex -PercentComplete $($ProgressLength*100/$TotalLength)
|
||||
$DestDirPath = Join-Path $DestDir $item.Name
|
||||
switch -Regex ($item.Mode) {
|
||||
'd-----' {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,22 @@
|
|||
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
|
||||
-Fix SCCM queries return mac address correctly
|
||||
-Update UserProfileBackup has progress bars!
|
||||
-Add UserProfileBackup has progress bars!
|
||||
-Update UserProfileBackup doesn't copy Sticky Notes anymore
|
||||
-Update UserProfileBackup reports fewer non-critical errors
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue