Made get-pc somewhat pipeline friendly
This commit is contained in:
parent
a1c8bc0f74
commit
c039beac33
|
|
@ -8,6 +8,14 @@ Function Get-SCCMQueryBlock {
|
|||
$SITENAME="100"
|
||||
$SCCMSERVER="shscm01.int.samhealth.net"
|
||||
$SCCMNAMESPACE="root\sms\site_100"
|
||||
# Spark connection params
|
||||
$Tenant = 'https://samaritanhealth-amc.ivanticloud.com'
|
||||
$Headers = @{
|
||||
"Content-Type" = "application/json"
|
||||
"Authorization" = 'rest_api_key=EB68123D62F8489295C807353C92D75B'
|
||||
"Accept" = "*/*"
|
||||
"Accept-Encoding" = "gzip, deflate, br"
|
||||
}
|
||||
|
||||
if(!(Test-Connection -ComputerName $comp -Count 1)){
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ Function Get-PC {
|
|||
-LogOffUser | remotely logs off user
|
||||
-Monitor | monitors computers for changes in status
|
||||
-NextPrinterName | generates next open printer name
|
||||
-NoResolve | skips hostname resolution, assumes provided name is a hostname
|
||||
-Orion | opens orion to the mac address of the pc
|
||||
-PatchNotes | read the patch notes
|
||||
-PCCleanup | removes temp files and inactive user profiles
|
||||
|
|
@ -129,6 +130,7 @@ Function Get-PC {
|
|||
[Switch]$LogOffUser,
|
||||
[Switch]$Monitor,
|
||||
[Switch]$NextPrinterName,
|
||||
[Switch]$NoResolve,
|
||||
[switch]$Orion,
|
||||
[Switch]$PatchNotes,
|
||||
[Switch]$PCCleanup,
|
||||
|
|
@ -153,6 +155,7 @@ Function Get-PC {
|
|||
[Switch]$WinProfileRebuild
|
||||
)
|
||||
|
||||
begin {
|
||||
#Data collection for Get-PC Wrapped TM
|
||||
$invokeData = @{
|
||||
Hostname = $env:COMPUTERNAME
|
||||
|
|
@ -257,8 +260,10 @@ Function Get-PC {
|
|||
|
||||
$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
|
||||
$PCID = 0 #This is a helper variable for the progress bar
|
||||
|
||||
} process {
|
||||
|
||||
$PCID = 0 #This is a helper variable for the progress bar
|
||||
$NumberofComputers = $ComputerName.Count
|
||||
foreach ($comp in $ComputerName) {
|
||||
$PCID++
|
||||
|
|
@ -270,7 +275,9 @@ Function Get-PC {
|
|||
continue
|
||||
}
|
||||
|
||||
$comp,$msg = Get-Hostname $comp
|
||||
if (-not ($NoResolve)) {
|
||||
$comp,$msg = Get-Hostname $comp
|
||||
}
|
||||
Write-Progress -Activity "Get-PC flags processing" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete ($PCID*100/$NumberOfComputers) -Id 1
|
||||
if ($msg -and -not $SHSPrinter) {
|
||||
if ($SoundEnabled) {
|
||||
|
|
@ -678,6 +685,8 @@ Function Get-PC {
|
|||
}
|
||||
Write-Progress -Activity "Get-PC flags processing" -Completed -Id 1
|
||||
|
||||
} end {
|
||||
|
||||
# Monitor list of PCs for change in online status or
|
||||
if ($Monitor) {
|
||||
Invoke-PCMonitor $getPCComputers
|
||||
|
|
@ -713,5 +722,7 @@ Function Get-PC {
|
|||
if ($Excel) {
|
||||
ExportToExcel $outPutArray
|
||||
}
|
||||
|
||||
} #end
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue