Merge branch 'HostnameRefactor'
This commit is contained in:
commit
f48cb0861d
|
|
@ -1,22 +1,6 @@
|
||||||
Function Get-Apps($ComputerName, $TableView) {
|
Function Get-Apps($ComputerName, $TableView) {
|
||||||
|
|
||||||
$SCCMServer = "shscm01.int.samhealth.net"
|
$86apps, $64apps = Get-SCCM_Apps $ComputerName
|
||||||
|
|
||||||
$SCCMNameSpace = "root\sms\site_100"
|
|
||||||
|
|
||||||
$SCCMX64Query = "select SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version, SMS_G_System_ADD_REMOVE_PROGRAMS_64.Publisher, SMS_G_System_ADD_REMOVE_PROGRAMS_64.InstallDate from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS_64 on
|
|
||||||
SMS_G_System_ADD_REMOVE_PROGRAMS_64.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'"
|
|
||||||
|
|
||||||
$SCCMX86Query = "select SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS.Version, SMS_G_System_ADD_REMOVE_PROGRAMS.Publisher, SMS_G_System_ADD_REMOVE_PROGRAMS.InstallDate from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on
|
|
||||||
SMS_G_System_ADD_REMOVE_PROGRAMS.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'"
|
|
||||||
|
|
||||||
$64apps = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMX64Query |
|
|
||||||
Select-Object -Property DisplayName | Add-Member -NotePropertyName x86/x64 -NotePropertyValue 64 -PassThru | Sort-Object -Property DisplayName
|
|
||||||
|
|
||||||
$86apps = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMX86Query |
|
|
||||||
Select-Object -Property DisplayName | Add-Member -NotePropertyName x86/x64 -NotePropertyValue 32 -PassThru | Sort-Object -Property DisplayName
|
|
||||||
|
|
||||||
#Checks if local computer
|
#Checks if local computer
|
||||||
if ($comp -eq $env:COMPUTERNAME) {
|
if ($comp -eq $env:COMPUTERNAME) {
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
Function Get-AssetConversion($ComputerName){
|
|
||||||
|
|
||||||
$SiteName="100"
|
|
||||||
|
|
||||||
$SCCMServer="shscm01.int.samhealth.net"
|
|
||||||
|
|
||||||
$SCCMNameSpace="root\sms\site_100"
|
|
||||||
#Set Asset Tag to $comp
|
|
||||||
$assetTagSCCM = $ComputerName
|
|
||||||
|
|
||||||
$SCCMQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId Where SMS_G_System_SYSTEM_ENCLOSURE.SMBIOSAssetTag = '$assetTagSCCM'"
|
|
||||||
|
|
||||||
#Set $comp to find hostname of PC
|
|
||||||
$nameHolder = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMQuery | Select-Object -First 1 -ExpandProperty Name
|
|
||||||
|
|
||||||
if($null -ne $nameHolder){
|
|
||||||
$ComputerName = $nameHolder
|
|
||||||
return $ComputerName
|
|
||||||
}
|
|
||||||
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
24
Private/Get-Hostname.ps1
Normal file
24
Private/Get-Hostname.ps1
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
function Get-Hostname ($name) {
|
||||||
|
if ($name.Length -eq 5) {
|
||||||
|
$res = Get-AssetConversion $name
|
||||||
|
if ($res) { return $res }
|
||||||
|
}
|
||||||
|
# Regex to match IP Address brought to you by https://stackoverflow.com/a/36760050
|
||||||
|
if ($name -match "^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$") {
|
||||||
|
$res = Resolve-DnsName $name
|
||||||
|
if ($res -and $res.NameHost -and ($res.NameHost -match "([^.]*)\.int\.samhealth\.net")) {
|
||||||
|
return $Matches[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($name.Length -eq 7) {
|
||||||
|
$res = Get-ServiceTagConversion $name
|
||||||
|
if ($res) { return $res }
|
||||||
|
}
|
||||||
|
# Regex to match MAC Address brought to you by https://stackoverflow.com/a/4260512
|
||||||
|
if ($name -match "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$") {
|
||||||
|
$res = Get-SCCM_PCFromMAC $name
|
||||||
|
if ($res) { return $res }
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name
|
||||||
|
}
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
Function HostnamesByPrinter($ComputerName){
|
|
||||||
|
|
||||||
$SiteName="100"
|
|
||||||
|
|
||||||
$SCCMServer="shscm01.int.samhealth.net"
|
|
||||||
|
|
||||||
$SCCMNameSpace="root\sms\site_100"
|
|
||||||
|
|
||||||
$FindHostnamesByPrinterQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_PRINTER_DEVICE on
|
|
||||||
SMS_G_System_PRINTER_DEVICE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_PRINTER_DEVICE.Name = '$ComputerName'"
|
|
||||||
|
|
||||||
$FindHostnamesByPrinterSCCM = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $FindHostnamesByPrinterQuery |
|
|
||||||
Select-Object -ExpandProperty Name
|
|
||||||
|
|
||||||
Return $FindHostnamesByPrinterSCCM
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -27,7 +27,11 @@ function Invoke-PCMonitor {
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
$null = [System.Windows.MessageBox]::Show($msg)
|
$null = [System.Windows.MessageBox]::Show($msg)
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
Write-Host "$msg" -NoNewline
|
Write-Host "$msg" -NoNewline
|
||||||
|
=======
|
||||||
|
Write-Output "$msg"
|
||||||
|
>>>>>>> HostnameRefactor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Update date and time so user knows script hasn't frozen
|
# Update date and time so user knows script hasn't frozen
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,23 @@ function Invoke-PrinterPurge ($printer) {
|
||||||
if (-not ($comps -is [array])) {
|
if (-not ($comps -is [array])) {
|
||||||
$comps = @($comps)
|
$comps = @($comps)
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = Read-Host "$($comps.Length) computers found, remove $printer from all of them? (y/N)"
|
$res = Read-Host "$($comps.Length) computers found, remove $printer from all of them? (y/N)"
|
||||||
if (-not ($res -match "^[yY]")) { return }
|
if (-not ($res -match "^[yY]")) { return }
|
||||||
|
|
||||||
for ($i = 0; $i -lt $comps.Length; $i += 1) {
|
for ($i = 0; $i -lt $comps.Length; $i += 1) {
|
||||||
$comp = $comps[$i]
|
$comp = $comps[$i]
|
||||||
Write-Progress -Activity "Dispatching Remove-Printer Jobs for $printer" -PercentComplete (100*$i / $comps.Length) -CurrentOperation "$comp $i/$($comps.Length)"
|
Write-Progress -Activity "Dispatching Remove-Printer Jobs for $printer" -PercentComplete (100*$i / $comps.Length) -CurrentOperation "$comp $i/$($comps.Length)"
|
||||||
|
|
||||||
if ($comp -like "*EPIC*") { continue }
|
if ($comp -like "*EPIC*") { continue }
|
||||||
|
|
||||||
if (-not (Test-Connection $comp -Count 1)) {
|
if (-not (Test-Connection $comp -Count 1)) {
|
||||||
Write-Output "$printer | $comp Offline"
|
Write-Output "$printer | $comp Offline"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
Remove-Printer $printer -ComputerName $comp -AsJob
|
Remove-Printer $printer -ComputerName $comp -AsJob
|
||||||
|
|
||||||
Write-Output "$printer | $comp Job Sent"
|
Write-Output "$printer | $comp Job Sent"
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Dispatching Remove-Printer Jobs for $printer" -Completed
|
Write-Progress -Activity "Dispatching Remove-Printer Jobs for $printer" -Completed
|
||||||
|
|
|
||||||
|
|
@ -420,4 +420,88 @@ Function Get-SCCM_USB($ComputerName) {
|
||||||
SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
SMS_R_System.ResourceId where SMS_R_System.Name = '$ComputerName'"
|
||||||
|
|
||||||
return Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $usbDevicesQuery
|
return Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $usbDevicesQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-SCCM_PCFromMAC($mac) {
|
||||||
|
# Try to get address in the right format first like 12:34:56:78:9A:BC
|
||||||
|
# Covers deliminating '-', '.', or no delimeter
|
||||||
|
$mac = $mac -replace '([^:.-]{2})[-.]?[^:](?!$)', '$1:'
|
||||||
|
$pcFromMacQuery = "select SMS_R_System.Name from SMS_R_System where SMS_R_System.MACAddresses = '$mac'"
|
||||||
|
|
||||||
|
return (Get-WmiObject -namespace $SCCMNAMESPACE -DirectRead -computer $SCCMSERVER -query $pcFromMacQuery).Name
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-SCCM_Apps($ComputerName) {
|
||||||
|
|
||||||
|
$SCCMX64Query = "select SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version, SMS_G_System_ADD_REMOVE_PROGRAMS_64.Publisher, SMS_G_System_ADD_REMOVE_PROGRAMS_64.InstallDate from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS_64 on
|
||||||
|
SMS_G_System_ADD_REMOVE_PROGRAMS_64.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'"
|
||||||
|
|
||||||
|
$SCCMX86Query = "select SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS.Version, SMS_G_System_ADD_REMOVE_PROGRAMS.Publisher, SMS_G_System_ADD_REMOVE_PROGRAMS.InstallDate from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on
|
||||||
|
SMS_G_System_ADD_REMOVE_PROGRAMS.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'"
|
||||||
|
|
||||||
|
$64apps = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMX64Query |
|
||||||
|
Select-Object -Property DisplayName | Add-Member -NotePropertyName x86/x64 -NotePropertyValue 64 -PassThru | Sort-Object -Property DisplayName
|
||||||
|
|
||||||
|
$86apps = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMX86Query |
|
||||||
|
Select-Object -Property DisplayName | Add-Member -NotePropertyName x86/x64 -NotePropertyValue 32 -PassThru | Sort-Object -Property DisplayName
|
||||||
|
|
||||||
|
return $86apps, $64apps
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Get-AssetConversion($ComputerName){
|
||||||
|
|
||||||
|
#Set Asset Tag to $comp
|
||||||
|
$assetTagSCCM = $ComputerName
|
||||||
|
|
||||||
|
$SCCMQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId Where SMS_G_System_SYSTEM_ENCLOSURE.SMBIOSAssetTag = '$assetTagSCCM'"
|
||||||
|
|
||||||
|
#Set $comp to find hostname of PC
|
||||||
|
$nameHolder = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMQuery | Select-Object -First 1 -ExpandProperty Name
|
||||||
|
|
||||||
|
if($null -ne $nameHolder){
|
||||||
|
$ComputerName = $nameHolder
|
||||||
|
return $ComputerName
|
||||||
|
}
|
||||||
|
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
|
||||||
|
Function HostnamesByPrinter($ComputerName){
|
||||||
|
|
||||||
|
$FindHostnamesByPrinterQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_PRINTER_DEVICE on
|
||||||
|
SMS_G_System_PRINTER_DEVICE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_PRINTER_DEVICE.Name = '$ComputerName'"
|
||||||
|
|
||||||
|
$FindHostnamesByPrinterSCCM = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $FindHostnamesByPrinterQuery |
|
||||||
|
Select-Object -ExpandProperty Name
|
||||||
|
|
||||||
|
Return $FindHostnamesByPrinterSCCM
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Get-ServiceTagConversion($ComputerName){
|
||||||
|
|
||||||
|
#Set Service Tag to $comp
|
||||||
|
$ServiceTagSCCM = $ComputerName
|
||||||
|
|
||||||
|
$SCCMQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on
|
||||||
|
SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM_ENCLOSURE.SerialNumber = '$ServiceTagSCCM'"
|
||||||
|
|
||||||
|
#Set $comp to find hostname of PC
|
||||||
|
$nameHolder = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMQuery | Select-Object -First 1 -ExpandProperty Name
|
||||||
|
|
||||||
|
if($null -ne $nameHolder)
|
||||||
|
{
|
||||||
|
$ComputerName = $nameHolder
|
||||||
|
return $ComputerName
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Get-SCCM_UserLastLoggedOn($user) {
|
||||||
|
$SCCMUserQuery = "select distinct SMS_R_System.Name from SMS_R_System where SMS_R_System.LastLogonUserName = '$user'"
|
||||||
|
|
||||||
|
$computerSCCM = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMUserQuery | Select-Object -ExpandProperty Name
|
||||||
|
return $computerSCCM
|
||||||
}
|
}
|
||||||
|
|
@ -37,16 +37,8 @@
|
||||||
return $obj
|
return $obj
|
||||||
}
|
}
|
||||||
$manager = $UserInfo.Manager.Split("=,")[1]
|
$manager = $UserInfo.Manager.Split("=,")[1]
|
||||||
|
|
||||||
$SiteName="100"
|
|
||||||
|
|
||||||
$SCCMServer="shscm01.int.samhealth.net"
|
|
||||||
|
|
||||||
$SCCMNameSpace="root\sms\site_100"
|
|
||||||
|
|
||||||
$SCCMUserQuery = "select distinct SMS_R_System.Name from SMS_R_System where SMS_R_System.LastLogonUserName = '$user'"
|
|
||||||
|
|
||||||
$computerSCCM = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMUserQuery | Select-Object -ExpandProperty Name
|
$computerSCCM = Get-SCCM_UserLastLoggedOn $user
|
||||||
$computerList = $computerSCCM -join ", "
|
$computerList = $computerSCCM -join ", "
|
||||||
$props = [ordered]@{
|
$props = [ordered]@{
|
||||||
Name=$UserInfo.DisplayName
|
Name=$UserInfo.DisplayName
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
Function Get-ServiceTagConversion($ComputerName){
|
|
||||||
|
|
||||||
$SiteName="100"
|
|
||||||
|
|
||||||
$SCCMServer="shscm01.int.samhealth.net"
|
|
||||||
|
|
||||||
$SCCMNameSpace="root\sms\site_100"
|
|
||||||
#Set Service Tag to $comp
|
|
||||||
$ServiceTagSCCM = $ComputerName
|
|
||||||
|
|
||||||
$SCCMQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on
|
|
||||||
SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM_ENCLOSURE.SerialNumber = '$ServiceTagSCCM'"
|
|
||||||
|
|
||||||
#Set $comp to find hostname of PC
|
|
||||||
$nameHolder = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMQuery | Select-Object -First 1 -ExpandProperty Name
|
|
||||||
|
|
||||||
if($null -ne $nameHolder)
|
|
||||||
{
|
|
||||||
$ComputerName = $nameHolder
|
|
||||||
return $ComputerName
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -135,10 +135,8 @@
|
||||||
New-Item -Path $Destination -ItemType Directory | Write-Verbose
|
New-Item -Path $Destination -ItemType Directory | Write-Verbose
|
||||||
} elseif ($site -eq $numSites) {
|
} elseif ($site -eq $numSites) {
|
||||||
$BackupDestination = Read-Host "Enter a PC asset, hostname, or custom path"
|
$BackupDestination = Read-Host "Enter a PC asset, hostname, or custom path"
|
||||||
# Parse input for asset tag, hostname, then full path
|
# Will attempt to convert to Hostname if possible, doesn't change if not
|
||||||
if ($BackupDestination -match "^[1-9]{5}$") {
|
$BackupDestination = Get-Hostname $BackupDestination
|
||||||
$BackupDestination = Get-AssetConversion $BackupDestination
|
|
||||||
}
|
|
||||||
# Treat as hostname and see if it's reachable
|
# Treat as hostname and see if it's reachable
|
||||||
if (Test-Connection -ComputerName $BackupDestination -Count 1) {
|
if (Test-Connection -ComputerName $BackupDestination -Count 1) {
|
||||||
# If so, get the filesystem path
|
# If so, get the filesystem path
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Backs up a user profile to a specified filepath.
|
Backs up a user profile to a specified filepath.
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Takes a input of hostname and user and will make a copy of the user profile
|
Takes a input of a user profile filepath, will make a copy of the user profile
|
||||||
and the Microsoft Roaming Folder and back it up to a specified filepath.
|
and the Microsoft Roaming Folder and back it up to a specified filepath.
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
$SiteName = "100"
|
|
||||||
$RemoteViewerPath = "C:\Program Files (x86)\ConfigMgr\bin\i386\CmRcViewer.exe"
|
$RemoteViewerPath = "C:\Program Files (x86)\ConfigMgr\bin\i386\CmRcViewer.exe"
|
||||||
$RemoteViewerPathAdd = "C:\Program Files (x86)\ConfigMgr Console\bin\i386\CmRcViewer.exe"
|
$RemoteViewerPathAdd = "C:\Program Files (x86)\ConfigMgr Console\bin\i386\CmRcViewer.exe"
|
||||||
$RemoteViewerPathAdd2 = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe"
|
$RemoteViewerPathAdd2 = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe"
|
||||||
|
|
|
||||||
|
|
@ -178,89 +178,50 @@ Function Get-PC {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
#Asset Tag Check
|
$oldcomp = $comp
|
||||||
if ($comp.length -eq 5 -and !$SHSPrinter) {
|
$comp = Get-Hostname $comp
|
||||||
$assettag = $comp
|
if (($oldcomp -eq $comp) -and (($comp.length -eq 5 -and !$SHSPrinter) -or ($comp.length -eq 7))) {
|
||||||
$comp = Get-AssetConversion $comp
|
if ($comp.length -eq 5 -and !$SHSPrinter) {
|
||||||
|
$msg = "$comp Asset Tag not in SMBIOS or CMDB"
|
||||||
if ($null -eq $comp) {
|
Write-Host "`n$msg" -ForegroundColor Red
|
||||||
Write-Host "`n$assettag Asset Tag not in SMBIOS or CMDB" -ForegroundColor Red
|
|
||||||
|
|
||||||
$props = [Ordered]@{
|
|
||||||
Hostname = "$assettag Asset Tag not in SMBIOS"
|
|
||||||
Status = ""
|
|
||||||
'Current User' = ""
|
|
||||||
'Last User(s)' = ""
|
|
||||||
'IP | MAC' = ""
|
|
||||||
Model = ""
|
|
||||||
'OS' = ""
|
|
||||||
'OS Build' = ""
|
|
||||||
'BIOS Ver' = ""
|
|
||||||
Encryption = ""
|
|
||||||
'Free Space' = ""
|
|
||||||
RAM = ""
|
|
||||||
'SSO Client' = ""
|
|
||||||
'Kiosk Role' = ""
|
|
||||||
'Citrix Ver' = ""
|
|
||||||
'Asset Tag' = ""
|
|
||||||
'Service Tag' = ""
|
|
||||||
'Last Reboot' = ""
|
|
||||||
'TPM Status' = ""
|
|
||||||
'MBAM GPO' = ""
|
|
||||||
Printers = ""
|
|
||||||
}
|
|
||||||
$obj = New-Object -TypeName PSObject -Property $props
|
|
||||||
|
|
||||||
$outPutArray += $obj
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
elseif ($comp.length -eq 7) {
|
||||||
#Service Tag Check
|
$msg = "$comp Service Tag not found in SCCM"
|
||||||
}
|
Write-Host "`n$msg" -ForegroundColor Red
|
||||||
elseif ($comp.length -eq 7) {
|
|
||||||
if (Resolve-DnsName $comp) {
|
|
||||||
#DREW SUCKS
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$serviceTag = $comp
|
|
||||||
$comp = Get-ServiceTagConversion $comp
|
|
||||||
|
|
||||||
if ($null -eq $comp) {
|
$props = [Ordered]@{
|
||||||
Write-Host "`n$serviceTag Service Tag not found in SCCM" -ForegroundColor Red
|
Hostname = "$msg"
|
||||||
|
Status = ""
|
||||||
$props = [Ordered]@{
|
'Current User' = ""
|
||||||
Hostname = "$serviceTag Service Tag not found in SCCM"
|
'Last User(s)' = ""
|
||||||
Status = ""
|
'IP | MAC' = ""
|
||||||
'Current User' = ""
|
Model = ""
|
||||||
'Last User(s)' = ""
|
'OS' = ""
|
||||||
'IP | MAC' = ""
|
'OS Build' = ""
|
||||||
Model = ""
|
'BIOS Ver' = ""
|
||||||
'OS' = ""
|
Encryption = ""
|
||||||
'OS Build' = ""
|
'Free Space' = ""
|
||||||
'BIOS Ver' = ""
|
RAM = ""
|
||||||
Encryption = ""
|
'SSO Client' = ""
|
||||||
'Free Space' = ""
|
'Kiosk Role' = ""
|
||||||
RAM = ""
|
'Citrix Ver' = ""
|
||||||
'SSO Client' = ""
|
'Asset Tag' = ""
|
||||||
'Kiosk Role' = ""
|
'Service Tag' = ""
|
||||||
'Citrix Ver' = ""
|
'Last Reboot' = ""
|
||||||
'Asset Tag' = ""
|
'TPM Status' = ""
|
||||||
'Service Tag' = ""
|
'MBAM GPO' = ""
|
||||||
'Last Reboot' = ""
|
Printers = ""
|
||||||
'TPM Status' = ""
|
|
||||||
'MBAM GPO' = ""
|
|
||||||
Printers = ""
|
|
||||||
}
|
|
||||||
$obj = New-Object -TypeName PSObject -Property $props
|
|
||||||
|
|
||||||
$outPutArray += $obj
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$obj = New-Object -TypeName PSObject -Property $props
|
||||||
|
|
||||||
|
$outPutArray += $obj
|
||||||
|
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#DREW SUCKS
|
||||||
|
|
||||||
#Pulls basic SNMP Data from printer $comp
|
#Pulls basic SNMP Data from printer $comp
|
||||||
if ($SHSPrinter) {
|
if ($SHSPrinter) {
|
||||||
Write-Progress -Activity "Querying Printers" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete (($PCID / $NumberofComputers) * 100)
|
Write-Progress -Activity "Querying Printers" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete (($PCID / $NumberofComputers) * 100)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
Patch: 2024-07-12
|
||||||
|
-Refactored SCCM Queries
|
||||||
|
-Fix Get-PC now accepts IP addresses and MAC addresses along with asset tags and service tags
|
||||||
|
|
||||||
Patch: 2024-07-11
|
Patch: 2024-07-11
|
||||||
-Update Monitor to detect when printers go online and offline
|
-Update Monitor to detect when printers go online and offline
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue