Refactored main, currently broke job system but there is a plan to rework the job system

This commit is contained in:
Zachary Gorman 2024-07-24 15:37:27 -07:00
parent 61038d43e5
commit e17f7e6ba3
5 changed files with 374 additions and 403 deletions

View file

@ -78,6 +78,9 @@ function Get-Devices {
$item.PSObject.TypeNames.Insert(0,'GetPC.Devices') $item.PSObject.TypeNames.Insert(0,'GetPC.Devices')
$out += $item $out += $item
} }
$item = [PSCustomObject]@{ }
$item.PSObject.TypeNames.Insert(0,'GetPC.Devices')
$out += $item
Write-Output $out Write-Output $out
} }

View file

@ -1,24 +1,30 @@
function Get-Hostname ([string]$name) { function Get-Hostname ([string]$name) {
$errMsg = ''
if ($name.Length -eq 5) { if ($name.Length -eq 5) {
$res = Get-AssetConversion $name $res = Get-AssetConversion $name
if ($res) { return $res } if ($res) { return $res,'' }
else { $errMsg += "$name Asset Tag not in SMBIOS or CMDB. "}
} }
# Regex to match IP Address brought to you by https://stackoverflow.com/a/36760050 # 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}$") { if ($name -match "^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$") {
$res = Resolve-DnsName $name $res = Resolve-DnsName $name
if ($res -and $res.NameHost -and ($res.NameHost -match "([^.]*)\.int\.samhealth\.net")) { if ($res -and $res.NameHost -and ($res.NameHost -match "([^.]*)\.int\.samhealth\.net")) {
return $Matches[1] return $Matches[1],''
} else {
$errMsg += "$name IP Address couldn't be resolved to hostname"
} }
} }
if ($name.Length -eq 7) { if ($name.Length -eq 7) {
$res = Get-ServiceTagConversion $name $res = Get-ServiceTagConversion $name
if ($res) { return $res } if ($res) { return $res,'' }
else { $errMsg += "$name Service Tag not found in SCCM"}
} }
# Regex to match MAC Address brought to you by https://stackoverflow.com/a/4260512 # 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})$") { if ($name -match "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$") {
$res = Get-SCCM_PCFromMAC $name $res = Get-SCCM_PCFromMAC $name
if ($res) { return $res } if ($res) { return $res,'' }
else { $errMsg += "$name MAC Address not found in SCCM"}
} }
return $name return $name, $errMsg
} }

View file

@ -8,8 +8,12 @@
Write-Host "Current Hostname: $ComputerName" Write-Host "Current Hostname: $ComputerName"
$NewHostName = Read-Host "New Hostname" $NewHostName = Read-Host "New Hostname"
Rename-Computer -ComputerName $ComputerName -NewName $NewHostName -DomainCredential $DomainUser -force -Restart $res = Rename-Computer -ComputerName $ComputerName -NewName $NewHostName -DomainCredential $DomainUser -force -Restart -PassThru
Write-Host "Renamed PC, successful. Restarting PC... Old Hostname: $ComputerName, New Hostname: $NewHostName" -ForegroundColor Green if ($res.HasSucceeded) {
Write-Host "Renamed PC, successful. Restarting PC... Old Hostname: $ComputerName, New Hostname: $NewHostName" -ForegroundColor Green
} else {
Write-Host "Failed to rename PC. Check user credentials" -ForegroundColor Red
}
}else{ }else{

View file

@ -136,7 +136,7 @@
} 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"
# Will attempt to convert to Hostname if possible, doesn't change if not # Will attempt to convert to Hostname if possible, doesn't change if not
$BackupDestination = Get-Hostname $BackupDestination $BackupDestination,$null = Get-Hostname $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

View file

@ -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
@ -53,7 +53,6 @@ Function Get-PC {
-PCReboot | reboots computer -PCReboot | reboots computer
-PCRename | renames computer -PCRename | renames computer
-RemoteDesktopApp | remote into computer using RDP -RemoteDesktopApp | remote into computer using RDP
-RequestLauncher | starts request launcher
-ResetRepository | remotely resets repository -ResetRepository | remotely resets repository
-Resources | more details about system resources -Resources | more details about system resources
-PrinterPurge | removes printer from all online computers -PrinterPurge | removes printer from all online computers
@ -104,7 +103,6 @@ Function Get-PC {
[Switch]$PCRename, [Switch]$PCRename,
[Switch]$Quiet, [Switch]$Quiet,
[Switch]$RemoteDesktopApp, [Switch]$RemoteDesktopApp,
[Switch]$RequestLauncher,
[Switch]$Resources, [Switch]$Resources,
[Switch]$ResetRepository, [Switch]$ResetRepository,
[Switch]$PrinterPurge, [Switch]$PrinterPurge,
@ -127,445 +125,405 @@ Function Get-PC {
break break
} }
<#$charA = $ComputerName.ToCharArray() # Stuff only run once
if($charA -contains '*'){ if ($Update) {
if($charA -lt 4){ #updates get pc
Write-Host "Wildcard searches need to be at least 4 characters long" -ForegroundColor Red Update-GetPC
return return
}
Write-Host "Starting CMDB Wildcard Search..."
$searchResults = Search-CMDB -hostname $ComputerName.Replace('*','') | Sort-Object -Property Hostname
Write-Output $searchResults
if($TableView){
$searchResults | Out-GridView -Title 'Get-PC Wildcard Search'
}
return
} }
#>
if ($PatchNotes) {
$scriptparent = (get-item $PSScriptRoot ).parent.FullName
Write-Host "`n"
Get-Content $scriptparent\patchnotes.txt
break
}
$getPCComputers = @() #List of computers that will get a batch query $getPCComputers = @() #List of computers that will get a batch query
$outPutArray = @() #For use near the end of the script to output to users screen in a specified format $outPutArray = @() #For use near the end of the script to output to users screen in a specified format
$PCID = 1 #This is a helper variable for the progress bar $PCID = 1 #This is a helper variable for the progress bar
if ($Jobsprinters) { $NumberofComputers = $ComputerName.Count
#runs the printer query as a set of jobs foreach ($comp in $ComputerName) {
$outPutArray = Get-PCBatchJob($ComputerName) -printers #Pulls user data from AD
Write-Output $outPutArray if ($SHSUser) {
$user = Get-SHSUser $comp
} $outPutArray += $user
continue
if (!$Jobsprinters) {
# Stuff only run once
if ($Update) {
#updates get pc
Update-GetPC
return
} }
$NumberofComputers = $ComputerName.Count $oldcomp = $comp
foreach ($comp in $ComputerName) { $comp,$msg = Get-Hostname $comp
if ($msg) {
if ($PatchNotes) { Write-Host "`n$msg" -ForegroundColor Red
$scriptparent = (get-item $PSScriptRoot ).parent.FullName
Write-Host "`n"
Get-Content $scriptparent\patchnotes.txt
break
}
#Pulls user data from AD
if ($SHSUser) {
$user = Get-SHSUser $comp
$outPutArray += $user
continue
}
$oldcomp = $comp $props = [Ordered]@{
$comp = Get-Hostname $comp Hostname = "$msg"
if (($oldcomp -eq $comp) -and (($comp.length -eq 5 -and !$SHSPrinter) -or ($comp.length -eq 7))) { Status = ""
if ($comp.length -eq 5 -and !$SHSPrinter) { 'Current User' = ""
$msg = "$comp Asset Tag not in SMBIOS or CMDB" 'Last User(s)' = ""
Write-Host "`n$msg" -ForegroundColor Red 'IP | MAC' = ""
} Model = ""
elseif ($comp.length -eq 7) { 'OS' = ""
$msg = "$comp Service Tag not found in SCCM" 'OS Build' = ""
Write-Host "`n$msg" -ForegroundColor Red 'BIOS Ver' = ""
} Encryption = ""
'Free Space' = ""
$props = [Ordered]@{ RAM = ""
Hostname = "$msg" 'SSO Client' = ""
Status = "" 'Kiosk Role' = ""
'Current User' = "" 'Citrix Ver' = ""
'Last User(s)' = "" 'Asset Tag' = ""
'IP | MAC' = "" 'Service Tag' = ""
Model = "" 'Last Reboot' = ""
'OS' = "" 'TPM Status' = ""
'OS Build' = "" 'MBAM GPO' = ""
'BIOS Ver' = "" Printers = ""
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
} }
$obj = New-Object -TypeName PSObject -Property $props
$outPutArray += $obj
continue
}
#DREW SUCKS #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)
$printer = Get-SHSPrinter $comp $printer = Get-SHSPrinter $comp
$outPutArray += $printer $outPutArray += $printer
$PCID++ $PCID++
continue continue
}
if ($SHSPrinterWeb) {
$printer = Get-SHSPrinter $comp
Write-Output $printer
Start-SHSPrinterWeb $printer
break
}
#Grabs all hostnames that have the requested printer installed on it
if ($HostnamesByPrinter) {
$printers = HostnamesByPrinter $comp
$out = @()
foreach ($printer in $printers) {
if ($printer -notlike '*EPIC*') {
$out += $printer
}
} }
if ($SHSPrinterWeb) { if ($TableView) {
$printer = Get-SHSPrinter $comp $out | Out-GridView -Title "Workstations Associated with $comp"
Write-Output $printer
Start-SHSPrinterWeb $printer
break
}
#Grabs all hostnames that have the requested printer installed on it
if ($HostnamesByPrinter) {
$printers = HostnamesByPrinter $comp
$out = @()
foreach ($printer in $printers) {
if ($printer -notlike '*EPIC*') {
$out += $printer
}
}
if ($TableView) {
$out | Out-GridView -Title "Workstations Associated with $comp"
}
else {
Write-Output $out
}
break
}
if ($PrinterPurge) {
Invoke-PrinterPurge $comp
continue
}
#Launches the request launcher script which containts landesk request template scripts
if ($RequestLauncher) {
Invoke-Expression \\int.samhealth.net\files\team\SHSISDesktopSolutions\Powershell\RequestLauncher\RequestLauncher.lnk
break
}
#Generates an available printer hostname. Useful for supplying a new hostname in new printer requests
if ($NextPrinterName) {
Find-NextPrinterName $comp
break
}
if ($Wake) {
Invoke-Wake $comp
continue
}
#PING HERE - All commands after here either require the computer to be online or need to know
#------------------------------------------------------------------------------------------------------------------------------------------------------------------#
$Connection = Test-Connection -ComputerName $comp -Count 1
Write-Progress -Activity "Connecting to computers" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete (($PCID / $NumberofComputers) * 100)
if ($Connection) {
$compStatus = 'Online'
} }
else { else {
$compStatus = 'Offline' Write-Output $out
} }
continue
}
#grabs some basic usb info from the wmi if ($PrinterPurge) {
if ($Usb) { Invoke-PrinterPurge $comp
if ($compStatus -ne 'Online') { continue
Write-Warning "$comp is $compStatus unable to proccess command" }
break
} #Generates an available printer hostname. Useful for supplying a new hostname in new printer requests
Get-USB $comp if ($NextPrinterName) {
Find-NextPrinterName $comp
break
}
if ($Wake) {
Invoke-Wake $comp
continue
}
#PING HERE - All commands after here either require the computer to be online or need to know
#------------------------------------------------------------------------------------------------------------------------------------------------------------------#
$Connection = Test-Connection -ComputerName $comp -Count 1
Write-Progress -Activity "Connecting to computers" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete (($PCID / $NumberofComputers) * 100)
if ($Connection) {
$compStatus = 'Online'
}
else {
$compStatus = 'Offline'
}
#grabs some basic usb info from the wmi
if ($Usb) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break break
} }
Get-USB $comp
#grabs info on attached monitors and usb devices break
if ($Devices) { }
ProgressBar -CurrentPC $comp -NumberofComputers $NumberofComputers -Percent $PCID -CurrentLocationText 'Devices' -CurrentPCNumber $PCID
$PCID++ #grabs info on attached monitors and usb devices
if ($Devices) {
if ($compStatus -ne 'Online') { ProgressBar -CurrentPC $comp -NumberofComputers $NumberofComputers -Percent $PCID -CurrentLocationText 'Devices' -CurrentPCNumber $PCID
Write-Warning "$comp is $compStatus skipping monitor query" $PCID++
}
if ($compStatus -ne 'Online') {
$out = Get-Devices $comp $compStatus Write-Warning "$comp is $compStatus skipping monitor query"
if ($null -eq $out) { }
Write-Warning "Unable to get device info for $comp"
continue $out = Get-Devices $comp $compStatus
} if ($null -eq $out) {
Write-Warning "Unable to get device info for $comp"
$outPutArray += $out
continue continue
} }
#Pulls the event log for the past x days $outPutArray += $out
if ($EventLog) { continue
}
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command" #Pulls the event log for the past x days
break if ($EventLog) {
}
if ($compStatus -ne 'Online') {
Get-PCEventLog $comp Write-Warning "$comp is $compStatus unable to proccess command"
break
}
#Will remove selected users profile from C:\Users\ and cleans the registry of their profile
if ($WinProfileRebuild) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-WinProfileRebuild $comp
break
}
if ($ResetRepository) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-ResetRepository $comp
break
}
#Backs up user profile to specified destination
if ($UserProfileBackup) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-UserProfileBackup $comp
break
}
#Remotely renames and restarts the computer.
if ($PCRename) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-PCRename $comp
break break
} }
#removes temp, cache files, and inactive user profiles Get-PCEventLog $comp
if ($PCCleanup) { break
}
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-PCCleanup $comp #Will remove selected users profile from C:\Users\ and cleans the registry of their profile
Get-PCProfileCleanup $comp if ($WinProfileRebuild) {
break
} if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
#Will reboot the users selected PC break
if ($PCReboot) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-PCReboot $comp
break
} }
#Pulls brief overview of system resources Get-WinProfileRebuild $comp
if ($Resources) { break
if ($compStatus -ne 'Online') { }
Write-Warning "$comp is $compStatus unable to proccess command"
continue if ($ResetRepository) {
}
get-resources $comp if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
continue continue
} }
Get-ResetRepository $comp
continue
}
#Backs up user profile to specified destination
if ($UserProfileBackup) {
#Pulls a list of installed programs from SCCM. May not be up to date if changes were made after the last sccm scan if ($compStatus -ne 'Online') {
if ($Apps) { Write-Warning "$comp is $compStatus unable to proccess command"
Get-Apps $comp $TableView break
}
Get-UserProfileBackup $comp
break
}
#Remotely renames and restarts the computer.
if ($PCRename) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-PCRename $comp
break
}
#removes temp, cache files, and inactive user profiles
if ($PCCleanup) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-PCCleanup $comp
Get-PCProfileCleanup $comp
break
}
#Will reboot the users selected PC
if ($PCReboot) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-PCReboot $comp
break
}
#Pulls brief overview of system resources
if ($Resources) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
continue
}
get-resources $comp
continue
}
#Pulls a list of installed programs from SCCM and Get-Package
if ($Apps) {
Get-Apps $comp $TableView
continue
}
if ($AppDiff) {
Get-AppDiff $comp $TableView
continue
}
if ($UninstallProgram) {
Invoke-UninstallProgram $comp
break
}
if ($GPUpdate) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-GPUpdate $comp
break
}
#Will not notify the user that another user is about to remote onto their PC
if ($Bypass) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-Bypass $comp
}
#Removes any indicator that another user is remoted onto their PC (like the green bar)
if ($Quiet) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Invoke-Quiet $comp
}
#Runs Remote Viewer, Thick Client Only
if ($ViewerRemote) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-ViewerRemote $comp
break
}
#Runs Remote Desktop Connection Application
if ($RemoteDesktopApp) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-RemoteDesktopApp $comp
break
}
#Same as C$ into a workstation
if ($FileSystem) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
continue continue
} }
if ($AppDiff) { Get-FileSystem $comp
Get-AppDiff $comp $TableView continue
continue }
}
#Will log off the current logged in user for the designated PC
if ($UninstallProgram) { #Adapted from Josh Gobens Logoff Script
Invoke-UninstallProgram $comp if ($LogOffUser) {
break
}
if ($GPUpdate) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-GPUpdate $comp
break
}
#Will not notify the user that another user is about to remote onto their PC
if ($Bypass) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-Bypass $comp
}
#Removes any indicator that another user is remoted onto their PC (like the green bar)
if ($Quiet) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Invoke-Quiet $comp
}
#Runs Remote Viewer, Thick Client Only
if ($ViewerRemote) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-ViewerRemote $comp
continue
}
#Runs Remote Desktop Connection Application if ($compStatus -ne 'Online') {
if ($RemoteDesktopApp) { Write-Warning "$comp is $compStatus unable to proccess command"
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-RemoteDesktopApp $comp
break break
} }
#Same as C$ into a workstation Get-LogOffUser $comp
if ($FileSystem) { break
}
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
continue
}
Get-FileSystem $comp if ($InstallNet35) {
continue Get-InstallNet35 $comp
} continue
}
#Will log off the current logged in user for the designated PC
#Adapted from Josh Gobens Logoff Script
if ($LogOffUser) {
if ($compStatus -ne 'Online') {
Write-Warning "$comp is $compStatus unable to proccess command"
break
}
Get-LogOffUser $comp
break
}
if ($InstallNet35) { #Checks if there is a WinRM service error
Get-InstallNet35 $comp #TODO Re-evaluate where we want the WSNetwork test
continue #$WSNetworkTest = Test-WSMan -ComputerName $comp
} #-or ($null -eq $WSNetworkTest)
#Checks if there is a WinRM service error #checks to see if the computer is in AD or the disabled computers OU and warns the user
#TODO Re-evaluate where we want the WSNetwork test if (get-module -ListAvailable -Name 'ActiveDirectory') {
#$WSNetworkTest = Test-WSMan -ComputerName $comp Write-Progress -Activity "Looking up computer in AD" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete (($PCID / $NumberofComputers) * 100)
#-or ($null -eq $WSNetworkTest) try { $adTest = ((Get-ADComputer $comp).DistinguishedName -match "Disabled Computers") } catch { $adTest = $true }
#checks to see if the computer is in AD or the disabled computers OU and warns the user if ($adTest) {
if (get-module -ListAvailable -Name 'ActiveDirectory') { Write-Warning "$comp is either disabled or off the domain"
Write-Progress -Activity "Looking up computer in AD" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete (($PCID / $NumberofComputers) * 100) }
try { $adTest = ((Get-ADComputer $comp).DistinguishedName -match "Disabled Computers") } catch { $adTest = $true } Write-Progress -Activity "Looking up computer in AD" -Completed
}
#Direct SCCM Queries
if ( $SCCM ) {
$result = Get-SCCMQuery $comp $NumberofComputers $PCID
$PCID++
$outPutArray += $result
}
else {
#Checks if local computer
if ($comp -eq $env:COMPUTERNAME) {
if ($adTest) { $result = Get-PCLocal $comp $NumberofComputers $PCID
Write-Warning "$comp is either disabled or off the domain" #$PCID++
} #$result = get-PCremoteCleaned $comp $Connection $NumberofComputers $PCID
Write-Progress -Activity "Looking up computer in AD" -Completed
}
#Direct SCCM Queries
if ( $SCCM ) {
$result = Get-SCCMQuery $comp $NumberofComputers $PCID
$PCID++
$outPutArray += $result $outPutArray += $result
#$getPCComputers += $comp
} }
else { else {
#$result = Get-PCRemote $comp $NumberofComputers $PCID
#$result = get-PCremoteCleaned $comp $Connection $NumberofComputers $PCID
#$PCID++
#$outPutArray += $result
#Write-Output $result
$getPCComputers += $comp
#Checks if local computer }
if ($comp -eq $env:COMPUTERNAME) { }
$result = Get-PCLocal $comp $NumberofComputers $PCID if ($Orion) {
#$PCID++ break
#$result = get-PCremoteCleaned $comp $Connection $NumberofComputers $PCID
$outPutArray += $result
#$getPCComputers += $comp
}
else {
#$result = Get-PCRemote $comp $NumberofComputers $PCID
#$result = get-PCremoteCleaned $comp $Connection $NumberofComputers $PCID
#$PCID++
#$outPutArray += $result
#Write-Output $result
$getPCComputers += $comp
}
}
if ($Orion) {
break
}
} }
} }