Small changes
This commit is contained in:
parent
fa912351b6
commit
836fa1d4b7
|
|
@ -130,7 +130,7 @@ Function Find-ISMBusinessObject {
|
|||
|
||||
try {
|
||||
|
||||
$Query = Invoke-RestMethod -Method GET -uri $URI -headers $Headers -TimeoutSec $SparkQueryTimeoutSec
|
||||
$Query = Invoke-RestMethod -Method GET -uri $URI -headers $Headers -TimeoutSec 15
|
||||
|
||||
if (!$Query){
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ Function Find-ISMBusinessObject {
|
|||
|
||||
$URI = "$Tenant/api/odata/businessobject/$BusinessObject`?`$top=100&`$skip=$Skip`$search=$SearchQuery"
|
||||
|
||||
$SkipQuery = Invoke-RestMethod -Method GET -uri $URI -headers $Headers -TimeoutSec $SparkQueryTimeoutSec
|
||||
$SkipQuery = Invoke-RestMethod -Method GET -uri $URI -headers $Headers -TimeoutSec 15
|
||||
|
||||
if ($SkipQuery){
|
||||
$Results += $SkipQuery.Value
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
#Attempts to remotely re-apply group policy. If this fails I let the user know so they can go to the computer and manually do it.
|
||||
try {
|
||||
Invoke-Command -ComputerName $ComputerName -ScriptBlock {& gpupdate /force}
|
||||
Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {& gpupdate /force}
|
||||
}
|
||||
catch{
|
||||
Write-Host "Unable to reapply group policy" -ForegroundColor Red
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ function Get-CMDBFallback {
|
|||
'Cellular Voice' = $cmdbData.SHS_IsCellularVoice
|
||||
'Cellular Data' = $cmdbData.SHS_IsCellularData
|
||||
'CMDB Location' = $locationData
|
||||
'CMDB Status' = $cmdbData.Status
|
||||
}
|
||||
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
|
@ -139,7 +140,7 @@ function Get-CMDBFallback {
|
|||
|
||||
$props = [Ordered]@{
|
||||
Hostname = $cmdbData.Name
|
||||
Status = $status
|
||||
Status = 'Offline'
|
||||
'Current User' = "Not Available"
|
||||
'Last User(s)' = $cmdbData.LoginName
|
||||
'IP | MAC' = $cmdbData.IPAddress + " | " + $cmdbData.MACAddress
|
||||
|
|
@ -157,6 +158,7 @@ function Get-CMDBFallback {
|
|||
'Last Reboot' = $null
|
||||
Printers = $null
|
||||
'CMDB Location' = $locationData
|
||||
'CMDB Status' = $cmdbData.Status
|
||||
}
|
||||
|
||||
if ($cmdbData.SHS_IsKiosk){
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
function Get-Hostname ([string]$name) {
|
||||
Write-Progress -Activity "Resolving hostname for $name" -PercentComplete 0 -ParentId 1
|
||||
# Return early if the hostname already resolves
|
||||
if (Resolve-DnsName $name) { return $name,''}
|
||||
if (Resolve-DnsName $name) {
|
||||
Write-Progress -Activity "Resolving hostname for $name" -Completed -ParentId 1
|
||||
return $name,''
|
||||
}
|
||||
Write-Progress -Activity "Resolving hostname for $name" -Status 'SCCM Asset Tag Lookup' -PercentComplete 10 -ParentId 1
|
||||
$errMsg = ''
|
||||
if ($name.Length -eq 5) {
|
||||
|
|
|
|||
|
|
@ -45,10 +45,14 @@ function Get-LastLoginTimes {
|
|||
}
|
||||
}
|
||||
if($ComputerName -eq $ENv:COMPUTERNAME){
|
||||
Invoke-Command -ScriptBlock $sb | Sort-Object LastLoginTime -Descending
|
||||
Invoke-Command -ScriptBlock $sb
|
||||
Select-Object Name, LocalPath, LastLoginTime |
|
||||
Sort-Object LastLoginTime -Descending
|
||||
}
|
||||
else{
|
||||
Invoke-Command -ComputerName $ComputerName -ScriptBlock $sb | Select-Object Name, LocalPath, LastLoginTime | Sort-Object LastLoginTime -Descending
|
||||
Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock $sb |
|
||||
Select-Object Name, LocalPath, LastLoginTime |
|
||||
Sort-Object LastLoginTime -Descending
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
function Get-LastLoginTimes {
|
||||
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter()]
|
||||
[String]
|
||||
$ComputerName = $ENv:COMPUTERNAME
|
||||
)
|
||||
|
||||
$sb = {
|
||||
$profiles = Get-CimInstance -Class Win32_UserProfile
|
||||
$profiles | Where {$_.SID.length -gt 10} | Foreach-Object {
|
||||
|
||||
$sid = $_.SID
|
||||
$prop = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$sid\"
|
||||
if($prop.LocalProfileUnLoadTimeHigh -and $prop.LocalProfileUnLoadTimeLow){
|
||||
$a = '{0:x}' -f $prop.LocalProfileUnLoadTimeHigh
|
||||
$b = '{0:x}' -f $prop.LocalProfileUnLoadTimeLow
|
||||
$dec = [bigint]::Parse("$a$b",'AllowHexSpecifier')
|
||||
$time = w32tm /ntte $dec
|
||||
$lastTime = [datetime]($time -split ' - ')[1]
|
||||
}
|
||||
else{
|
||||
$lastTime = $null
|
||||
}
|
||||
|
||||
[PSCustomObject]@{
|
||||
Name = ($_.LocalPath -split 'C:\\Users\\')[1]
|
||||
LocalPath = $_.LocalPath
|
||||
LastLoginTime = $lastTime
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if($ComputerName -eq $ENv:COMPUTERNAME){
|
||||
Invoke-Command -ScriptBlock $sb | Sort-Object LastLoginTime -Descending
|
||||
}
|
||||
else{
|
||||
Invoke-Command -ComputerName $ComputerName -ScriptBlock $sb | Select-Object Name, LocalPath, LastLoginTime | Sort-Object LastLoginTime -Descending
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
if(Test-Connection -ComputerName $HostName -Count 1) {
|
||||
|
||||
Invoke-Command -ComputerName $HostName -ScriptBlock {
|
||||
Invoke-Command -ComputerName $HostName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName NetFx3 -Source \\shscm01\packages\Microsoft\dotNet\3.5 -LimitAccess -All
|
||||
} -AsJob -JobName installNet
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
Write-Progress -Activity "Retrieving data from $Env:COMPUTERNAME" -Status "Bitlocker, Current User, RAM, Serial Number, and OS Version" -PercentComplete 20
|
||||
try {$bitlocker = manage-bde -status C:} catch {$bitlocker = $null} # | Bitlocker Status
|
||||
try {$PCInfo = get-computerinfo} catch {$PCInfo = $null}
|
||||
Write-Progress -Activity "Retrieving data from $Env:COMPUTERNAME" -Status "Printers, Imprivata, and Stoarge Disk Type" -PercentComplete 30
|
||||
Write-Progress -Activity "Retrieving data from $Env:COMPUTERNAME" -Status "Printers, Imprivata, and Storage Disk Type" -PercentComplete 30
|
||||
try {$physicalDisk = Get-PhysicalDisk} catch {$physicalDisk = $null} # | Disk Type
|
||||
try {$win32_printer = (Get-CimInstance -ClassName win32_printer | Where-Object {$_.PortName -ne 'PORTPROMPT:' -and $_.PortName -ne 'nul:' -and $_.PortName -ne 'SHRFAX:'} | Select-Object -ExpandProperty Name) -join ' || ' }
|
||||
catch{ $win32_printer = $null} # | Printers
|
||||
|
|
@ -365,6 +365,7 @@
|
|||
$obj | Add-Member -MemberType NoteProperty -Name 'TPM Status' -Value "$tpmStatus"
|
||||
$obj | Add-Member -MemberType NoteProperty -Name 'Printers' -Value "$printers"
|
||||
$obj | Add-Member -MemberType NoteProperty -Name 'CMDB Location' -Value "$LocationData"
|
||||
$obj | Add-Member -MemberType NoteProperty -Name 'CMDB Status' -Value $cmdbData.Status
|
||||
if($cmdbData.SHS_IsException -eq 'True'){
|
||||
Write-host "***NOTICE: $ENV:COMPUTERNAME is a Device Exception computer. Please check CMDB/Asset Mgmt prior to supporting this workstation. ***" -BackgroundColor Black -ForegroundColor Yellow
|
||||
$obj | Add-Member -MemberType NoteProperty -Name 'DEL Owner' -Value $cmdbData.SHS_ExceptionContact
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
Write-host "Attempting to Reboot $ComputerName." -ForegroundColor Yellow
|
||||
|
||||
Write-Host "Executing Bypass..."
|
||||
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
|
||||
Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
|
||||
If (Test-Path 'C:\Program Files (x86)\PGP Corporation\PGP Desktop\PGPwde.exe')
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
}
|
||||
|
||||
Write-Host "Executing Restart..."
|
||||
Invoke-Command -ComputerName $ComputerName -ScriptBlock {shutdown -r -t 0}
|
||||
Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {shutdown -r -t 0}
|
||||
Write-Host "Reboot Command as been sent"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,589 +0,0 @@
|
|||
function Get-PCRemote {
|
||||
param (
|
||||
[string]$comp,
|
||||
[int]$NumberofComputers,
|
||||
[int]$PCID
|
||||
)
|
||||
$compstatus = "Online"
|
||||
$i = 0
|
||||
$i++ | ProgressBar $i $comp "ipV4" $NumberofComputers $PCID
|
||||
$ipV4 = Get-PCIPAddress $comp
|
||||
$i++ | ProgressBar $i $comp "MAC" $NumberofComputers $PCID
|
||||
$mac = Get-PCMACAddress $comp
|
||||
$i++ | ProgressBar $i $comp "Adapter" $NumberofComputers $PCID
|
||||
$adapter = Get-PCAdapter $comp
|
||||
$i++ | ProgressBar $i $comp "Usernames" $NumberofComputers $PCID
|
||||
$userName = Get-PCUserName $comp
|
||||
$i++ | ProgressBar $i $comp "Computer Model" $NumberofComputers $PCID
|
||||
$compModel = Get-PCCompModel $comp
|
||||
$i++ | ProgressBar $i $comp "RAM Size" $NumberofComputers $PCID
|
||||
$compMemory = Get-PCCompMemory $comp
|
||||
$i++ | ProgressBar $i $comp "CPU Type" $NumberofComputers $PCID
|
||||
$compCPU = Get-CPUType $comp
|
||||
$i++ | ProgressBar $i $comp "HDD/SSD Space" $NumberofComputers $PCID
|
||||
$compFreeSpace = Get-PCCompFreeSpace $comp
|
||||
$i++ | ProgressBar $i $comp "Service Tag" $NumberofComputers $PCID
|
||||
$compServiceTag = Get-PCCompServiceTag $comp
|
||||
$i++ | ProgressBar $i $comp "Bios Version" $NumberofComputers $PCID
|
||||
$compBiosVersion = Get-PCCompBiosVersion $comp
|
||||
$i++ | ProgressBar $i $comp "Last Boot Time" $NumberofComputers $PCID
|
||||
$compLastBootUpTime = Get-PCCompLastBootUpTime $comp
|
||||
$i++ | ProgressBar $i $comp "Asset Tag" $NumberofComputers $PCID
|
||||
$compAssetTag = Get-PCCompAssetTag $comp
|
||||
$i++ | ProgressBar $i $comp "Encryption" $NumberofComputers $PCID
|
||||
$hasBitLocker = Get-PCHasBitLocker $comp
|
||||
$i++ | ProgressBar $i $comp "OS Version" $NumberofComputers $PCID
|
||||
$compOSVersion = Get-PCCompOSVersion $comp
|
||||
$i++ | ProgressBar $i $comp "OS Architecture" $NumberofComputers $PCID
|
||||
$compArchitectureBuild = Get-PCCompArchitectureBuild $comp
|
||||
$i++ | ProgressBar $i $comp "OS Build #" $NumberofComputers $PCID
|
||||
$compOSBuildNumber = Get-PCCompOSBuildNumber $comp
|
||||
$i++ | ProgressBar $i $comp "Drive Type" $NumberofComputers $PCID
|
||||
$driveType = Get-PCDriveType $comp
|
||||
$i++ | ProgressBar $i $comp "Citrix Version" $NumberofComputers $PCID
|
||||
$citrixVersion = Get-PCCitrixVersion $comp
|
||||
$i++ | ProgressBar $i $comp "Chassis Type" $NumberofComputers $PCID
|
||||
$chassisType = Get-ChassisType $compCPU $compModel
|
||||
|
||||
$i++ | ProgressBar $i $comp "Last Users" $NumberofComputers $PCID
|
||||
$lastUser = Get-PCLastUser $comp
|
||||
$i++ | ProgressBar $i $comp "Time Stamp" $NumberofComputers $PCID
|
||||
$lastUserTimeStamp = Get-PCLastUserTimeStamp $comp
|
||||
|
||||
|
||||
if($lastUser.Count -gt 1){
|
||||
|
||||
$lastUser1 = ($lastUser[0] + "-(" + $lastUserTimeStamp[0] + ")").Split("-")
|
||||
$lastUser2 = ($lastUser[1] + "-(" + $lastUserTimeStamp[1] + ")").Split("-")
|
||||
$lastUser3 = ($lastUser[2] + "-(" + $lastUserTimeStamp[2] + ")").Split("-")
|
||||
|
||||
$TotalLastUsers = "$lastUser1 $lastUser2 $lastUser3"
|
||||
|
||||
}else{
|
||||
|
||||
$TotalLastUsers = "$lastUser ($lastUserTimeStamp)"
|
||||
}
|
||||
|
||||
$i++ | ProgressBar $i $comp "Imprivata Type" $NumberofComputers $PCID
|
||||
#This command determines if it isget-p a SUD or MUD. 0 = SUD, 1 = MUD
|
||||
$imprivataType = Get-PCImprivataType $comp
|
||||
$i++ | ProgressBar $i $comp "Kiosk Role" $NumberofComputers $PCID
|
||||
#Determines if the kiosk role, example "Exam Room"
|
||||
$kioskRole = Get-PCKioskRole $comp
|
||||
$i++ | ProgressBar $i $comp "Kiosk Type" $NumberofComputers $PCID
|
||||
#This command returns either 1 or 2. 1 = "SUD/MUD", 2 = "Kiosk"
|
||||
$kioskType = Get-PCKioskType $comp
|
||||
$i++ | ProgressBar $i $comp "ReleaseID" $NumberofComputers $PCID
|
||||
#This command returns the OS Version
|
||||
$releaseID = Get-PCReleaseID $comp
|
||||
$i++ | ProgressBar $i $comp "Printers" $NumberofComputers $PCID
|
||||
#This command pulls any printers connected/installed onto the current PC
|
||||
$getPrinter = Get-PCPrinter $comp
|
||||
$i++ | ProgressBar $i $comp "GPO Status" $NumberofComputers $PCID
|
||||
$getGPOStatus = Get-GPOStatus $comp
|
||||
$i++ | ProgressBar $i $comp "TPM Status" $NumberofComputers $PCID
|
||||
$tpmStatus = Get-TPMStatus $comp
|
||||
|
||||
if($compOSVersion -ne "Microsoft Windows 10 Enterprise"){
|
||||
|
||||
$driveType = "(Drive Type: Unavailable on Win 7)"
|
||||
}
|
||||
|
||||
Switch($kioskType)
|
||||
{
|
||||
1 {}
|
||||
2 {$imprivataType = "Kiosk"}
|
||||
}
|
||||
|
||||
if($imprivataType -eq "Kiosk" -and $getPrinter -ne '') #Checks if PC is a Kiosk with a locally/networked installed Printer
|
||||
{
|
||||
$getPrinter = $getPrinter + " (Check Epic Printer Mappings)"
|
||||
}
|
||||
elseif($imprivataType -eq "Kiosk" -and !$getPrinter) #Checks if PC is a Kiosk and does not have a locally/networked installed Printer
|
||||
{
|
||||
$getPrinter = "Check Epic Printer Mappings"
|
||||
}
|
||||
elseif(!$getPrinter)
|
||||
{
|
||||
$getPrinter = "No Local/Networked Printer (Check Printer Mappings)"
|
||||
}
|
||||
|
||||
if(!$kioskRole)
|
||||
{
|
||||
$kioskRole = "N/A"
|
||||
}
|
||||
|
||||
if(!$userName)
|
||||
{
|
||||
$userName = "**None**"
|
||||
}
|
||||
|
||||
if(!$compAssetTag)
|
||||
{
|
||||
$compAssetTag = "(N/A in SMBios)"
|
||||
}
|
||||
|
||||
$compFreeSpaceGB = [math]::Round(($compFreeSpace[0] / 1GB),2)
|
||||
#$compFreeSpaceMB = [math]::Round(($compFreeSpace[0] / 1MB))
|
||||
$compMemory = [math]::Round(($compMemory / 1GB))
|
||||
|
||||
$compFreeSpaceMB = "$compFreeSpaceMB" + ' MB'
|
||||
$compFreeSpaceGB = "$compFreeSpaceGB" + ' GB'
|
||||
$compMemory = "$compMemory" + ' GB'
|
||||
|
||||
$locationData = Get-LocationDetails $comp
|
||||
|
||||
$i++ | ProgressBar $i $comp "Generating Output" $NumberofComputers $PCID
|
||||
|
||||
$props = [Ordered]@{
|
||||
Hostname = "$comp"
|
||||
Status = "$compStatus"
|
||||
'Current User' = "$userName"
|
||||
'Last User(s)' = "$TotalLastUsers"
|
||||
'IP | MAC' = "$ipV4 | $mac"
|
||||
'Adapter' = "$adapter"
|
||||
Model = "$compModel ($chassisType)"
|
||||
'OS' = "$compOSVersion" + " ($compArchitectureBuild)"
|
||||
'OS Build' = "Vers #$releaseID |" + " Build #$compOSBuildNumber"
|
||||
'BIOS Ver' = "$compBiosVersion"
|
||||
Encryption = "$hasBitLocker"
|
||||
'Free Space' = "$compFreeSpaceGB " + "/ " + $compfreeSpace[1] + " GB | $driveType"
|
||||
RAM = "$compMemory"
|
||||
'SSO Client' = "$imprivataType"
|
||||
'Kiosk Role' = "$kioskRole"
|
||||
'Citrix Ver' = "$citrixVersion"
|
||||
'Asset Tag' = "$compAssetTag"
|
||||
'Service Tag' = "$compServiceTag"
|
||||
'Last Reboot' = "$compLastBootUpTime"
|
||||
'TPM Status' = "$tpmStatus"
|
||||
'MBAM GPO' = "$getGPOStatus"
|
||||
Printers = "$getPrinter"
|
||||
'CMDB Location' = $locationData
|
||||
}
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
||||
return $obj
|
||||
}
|
||||
|
||||
Function Get-PCIPAddress ($ComputerName){
|
||||
|
||||
$ipV4 = Test-Connection -ComputerName ($ComputerName) -Count 1 | Select-Object -ExpandProperty IPV4Address
|
||||
|
||||
Return $ipV4
|
||||
}
|
||||
|
||||
Function Get-PCMACAddress ($ComputerName){
|
||||
|
||||
$mac = (Get-CimInstance win32_networkadapterconfiguration -ComputerName ($ComputerName) | Where-Object {$_.IpEnabled -Match "True"} |
|
||||
Select-Object -Expand macaddress) -join ","
|
||||
|
||||
Return $mac
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCAdapter ($ComputerName){
|
||||
|
||||
$adapter = (Get-CimInstance win32_networkadapterconfiguration -ComputerName ($ComputerName) | Where-Object {$_.IpEnabled -Match "True"} |
|
||||
Select-Object -Expand Description)
|
||||
|
||||
if($adapter -is [array]){
|
||||
$adapter = $adapter[0]
|
||||
}
|
||||
|
||||
Return $adapter
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCUserName ($ComputerName){
|
||||
|
||||
$Username = (Get-CimInstance -Class win32_computersystem -ComputerName $ComputerName).UserName
|
||||
if($null -eq $Username){
|
||||
|
||||
$Username = (Invoke-Command {Get-Process Explorer -IncludeUsername | Where-Object { $_.Username -notlike "*SYSTEM" }} -SessionOption (New-PSSessionOption -NoMachineProfile) -ComputerName $ComputerName).Username
|
||||
|
||||
if($null -ne $Username){
|
||||
$Username = "$Username (RDP/Inactive)"
|
||||
}
|
||||
|
||||
}
|
||||
Return $Username
|
||||
}
|
||||
|
||||
Function Get-PCCompModel ($ComputerName){
|
||||
|
||||
$CompModel = (Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName $ComputerName).Model #| Select -ExpandProperty Model
|
||||
|
||||
Return $CompModel
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompMemory ($ComputerName){
|
||||
|
||||
$CompMemory = (Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName $ComputerName).TotalPhysicalMemory #| Select -ExpandProperty TotalPhysicalMemory
|
||||
|
||||
Return $CompMemory
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompFreeSpace ($ComputerName){
|
||||
|
||||
$CompFreeSpace = Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3" -ComputerName $ComputerName | Measure-Object -Property FreeSpace -Sum | Select-Object -ExpandProperty Sum
|
||||
$TotalSpace = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3" -ComputerName $ComputerName | Select-Object -ExpandProperty Size) / 1GB
|
||||
$out = @($CompFreeSpace,[math]::Round($TotalSpace,2))
|
||||
Return $out
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompServiceTag ($ComputerName){
|
||||
|
||||
$CompServiceTag = (Get-CimInstance -Class win32_bios -ComputerName $ComputerName).SerialNumber #| Select -ExpandProperty SerialNumber
|
||||
|
||||
Return $CompServiceTag
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompBiosVersion ($ComputerName){
|
||||
|
||||
$CompBiosVersion = (Get-CimInstance -Class win32_bios -ComputerName $ComputerName).SMBIOSBIOSVersion #| Select -ExpandProperty SMBIOSBIOSVersion
|
||||
|
||||
Return $CompBiosVersion
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompLastBootUpTime ($ComputerName){
|
||||
|
||||
$CompLastBootUpTime = (Get-CimInstance Win32_OperatingSystem -ComputerName $ComputerName).LastBootUpTime
|
||||
|
||||
Return $CompLastBootUpTime
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompAssetTag ($ComputerName){
|
||||
|
||||
$CompAssetTag = (Get-CimInstance Win32_SystemEnclosure -ComputerName $ComputerName).SMBiosAssetTag
|
||||
|
||||
Return $CompAssetTag
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCHasBitLocker ($ComputerName){
|
||||
|
||||
$bitlocker = manage-bde -ComputerName $ComputerName -status C:
|
||||
$PercentageEncrypted = ((manage-bde -ComputerName $ComputerName -status C: | Select-String "Percentage Encrypted") -split ': ')[1]
|
||||
|
||||
[int]$IntPercentageEncrypted = $PercentageEncrypted.Substring(0,4)
|
||||
|
||||
If($bitlocker -like '*error*')
|
||||
{
|
||||
$EncryptionStatus = 'BitLocker - Error - Please investigate'
|
||||
|
||||
Return $EncryptionStatus
|
||||
}
|
||||
Elseif($IntPercentageEncrypted -eq 100)
|
||||
{
|
||||
$EncryptionStatus = "BitLocker - Encrypted ($PercentageEncrypted)"
|
||||
|
||||
Return $EncryptionStatus
|
||||
}
|
||||
ElseIf($IntPercentageEncrypted -gt 1)
|
||||
{
|
||||
|
||||
$EncryptionStatus = "BitLocker - Encrypting ($PercentageEncrypted)"
|
||||
|
||||
Return $EncryptionStatus
|
||||
}
|
||||
Else
|
||||
{
|
||||
$EncryptionStatus = "BitLocker - Decrypted ($PercentageEncrypted)"
|
||||
|
||||
Return $EncryptionStatus
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompOSVersion ($ComputerName){
|
||||
|
||||
$CompOSVersion = Get-CimInstance win32_operatingsystem -ComputerName $ComputerName | ForEach-Object caption
|
||||
|
||||
Return $CompOSVersion
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompArchitectureBuild ($ComputerName){
|
||||
|
||||
$CompArchitectureBuild = (Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName).OSArchitecture
|
||||
|
||||
Return $CompArchitectureBuild
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCCompOSBuildNumber ($ComputerName){
|
||||
|
||||
$CompOSBuildNumber = (Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName).BuildNumber
|
||||
|
||||
Return $CompOSBuildNumber
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCDriveType ($ComputerName){
|
||||
|
||||
$DriveType = New-CimSession $ComputerName #Create a CIM SESSION with PC name
|
||||
$DriveType = Get-PhysicalDisk -CimSession $ComputerName | Select-Object -ExpandProperty MediaType #Access CimSession that we created before
|
||||
Remove-CimSession $ComputerName #closes the CIM-SESSION
|
||||
|
||||
Return $DriveType
|
||||
}
|
||||
|
||||
Function Get-PCCitrixVersion ($ComputerName){
|
||||
|
||||
$CitrixViewer = "\\$ComputerName\C$\Program Files (X86)\Citrix\ICA Client\CDViewer.exe" #Checks this default install path
|
||||
$CitrixVersion = Get-Command $citrixViewer | select-object -ExpandProperty Version #Grabs Citrix version number
|
||||
|
||||
#checks if Citrix is in the correct path
|
||||
if( !(Test-path $CitrixViewer)){
|
||||
|
||||
$CitrixVersion = "Not Installed"
|
||||
}
|
||||
|
||||
Return $CitrixVersion
|
||||
}
|
||||
|
||||
Function Get-PCLastUser ($ComputerName){
|
||||
|
||||
$LastUser = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Get-ChildItem -Path C:\Users -Directory -Force -Exclude Public,Default,'Default User','All Users' |
|
||||
Sort-Object -Property LastWriteTime -Descending | Select-Object -First 3 -ExpandProperty Name}
|
||||
|
||||
Return $LastUser
|
||||
}
|
||||
|
||||
Function Get-PCLastUserTimeStamp ($ComputerName){
|
||||
|
||||
$LastUserTimeStamp = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Get-ChildItem -Path C:\Users -Directory -Force -Exclude Public,Default,'Default User','All Users' |
|
||||
Sort-Object -Property LastWriteTime -Descending | Select-Object -First 3 -ExpandProperty LastWriteTime }
|
||||
|
||||
Return $LastUserTimeStamp
|
||||
}
|
||||
|
||||
Function Get-PCImprivataType ($ComputerName){
|
||||
|
||||
$ImprivataType = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\SSOProvider\ISXAgent | Select-Object -ExpandProperty FUS_Enabled }
|
||||
|
||||
if($null -eq $ImprivataType){
|
||||
|
||||
$ImprivataType = 2
|
||||
}
|
||||
|
||||
Switch($ImprivataType)
|
||||
{
|
||||
0 {$ImprivataType = "SUD"}
|
||||
1 {$ImprivataType = "MUD"}
|
||||
Default {$ImprivataType = "Imprivata Agent not Installed"}
|
||||
}
|
||||
|
||||
Return $ImprivataType
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCKioskRole ($ComputerName){
|
||||
|
||||
$KioskRole = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\SHSCustom | Select-Object -ExpandProperty KioskRole }
|
||||
|
||||
Return $KioskRole
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCKioskType ($ComputerName){
|
||||
|
||||
$KioskType = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SSOProvider\ISXAgent | Select-Object -ExpandProperty Type}
|
||||
|
||||
Return $KioskType
|
||||
}
|
||||
|
||||
Function Get-PCReleaseID ($ComputerName){
|
||||
|
||||
$ReleaseID = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('ReleaseID')
|
||||
|
||||
}
|
||||
|
||||
Return $ReleaseID
|
||||
|
||||
}
|
||||
|
||||
Function Get-PCPrinter ($ComputerName){
|
||||
|
||||
$GetPrinter = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
(Get-CimInstance -Class Win32_Printer | Where-Object -Property PortName -ne nul: |
|
||||
Where-Object -Property PortName -ne PORTPROMPT: | Where-Object -Property PortName -ne SHRFAX: |
|
||||
Select-Object -ExpandProperty Name) -join ' || '}
|
||||
|
||||
Return $GetPrinter
|
||||
}
|
||||
|
||||
Function Get-TPMStatus ($ComputerName){
|
||||
|
||||
$tpmStatus = Get-WmiObject -Namespace root\cimv2\security\microsofttpm -Class win32_tpm -ComputerName $ComputerName |
|
||||
Select-Object -ExpandProperty IsEnabled_InitialValue
|
||||
|
||||
#Determine TPM Status
|
||||
if($tpmStatus -eq $true)
|
||||
{
|
||||
$tpmStatus = "On & Activated"
|
||||
}
|
||||
elseif($tpmStatus -eq $false)
|
||||
{
|
||||
$tpmStatus = "On & Deactivated"
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpmStatus = "TPM Off"
|
||||
}
|
||||
|
||||
Return $tpmStatus
|
||||
}
|
||||
|
||||
Function Get-GPOStatus ($ComputerName){
|
||||
|
||||
Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock{
|
||||
|
||||
$gpoPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\FVE\MDOPBitLockerManagement"
|
||||
$gpoValue = Get-ItemPropertyValue -Path $gpoPath -Name "KeyRecoveryServiceEndPoint"
|
||||
|
||||
Switch($GpoValue -eq "https://shsmbam1.int.samhealth.net/MBAMRecoveryAndHardwareService/CoreService.svc")
|
||||
{
|
||||
$true {$gpoStatus = "GPO Applied"}
|
||||
$false {$gpoStatus = "GPO Not Applied (Check if system is member of group MBAM_Default on ADUC"}
|
||||
Default {$gpoStatus = "Error...GPOTEST Line PCRemote Line 276"}
|
||||
}
|
||||
Return $gpoStatus
|
||||
}
|
||||
}
|
||||
|
||||
Function Get-CPUType ($ComputerName){
|
||||
|
||||
$CPU = (Get-CimInstance -ClassName Win32_processor -ComputerName $ComputerName).Name
|
||||
|
||||
Return $CPU
|
||||
}
|
||||
|
||||
#If updating (Get-ChassisType), make sure to update the PCLocal & SCCMQuery module as well
|
||||
Function Get-ChassisType ($CPU, $Model){
|
||||
|
||||
Switch -Wildcard($Model)
|
||||
{
|
||||
"Optiplex*" {
|
||||
Switch -Wildcard($CPU)
|
||||
{
|
||||
"Intel(R) Core(TM) i5-9500 CPU*" {Return "SFF"} #5070
|
||||
|
||||
"Intel(R) Core(TM) i5-6500 CPU*" {Return "SFF"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i5-6500T*" {Return "Micro"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i7-6700 CPU*" {Return "SFF"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i7-6700T*" {Return "Micro"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i5-10500T*" {Return "Micro"} #5080
|
||||
|
||||
"Intel(R) Core(TM) i5-9500T*" {Return "Micro"} #5070
|
||||
|
||||
"Intel(R) Core(TM) i5-8500 CPU*" {Return "SFF"} #5060
|
||||
|
||||
"Intel(R) Core(TM) i5-8500T*" {Return "Micro"} #5060
|
||||
|
||||
"Intel(R) Core(TM) i5-7500*" {Return "SFF"} #5050
|
||||
|
||||
"Intel(R) Core(TM) i5-4670 CPU*" {Return "SFF"} #9020
|
||||
|
||||
"Intel(R) Core(TM) i5-4590 CPU*" {Return "SFF"} #9020
|
||||
|
||||
"Intel(R) Core(TM) i5-4590T CPU*" {Return "Micro"} #9020M
|
||||
|
||||
"Intel(R) Core(TM) i5-4690 CPU*" {Return "SFF"} #9020
|
||||
|
||||
"Intel(R) Core(TM) i5-3550 CPU*" {Return "SFF"} #9010
|
||||
|
||||
"Intel(R) Core(TM) i5-2400 CPU*" {Return "SFF"} #990
|
||||
|
||||
Default {Return "Optiplex - Chassis Type - Unknown"}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
"Latitude*" {
|
||||
Return "Laptop"
|
||||
}
|
||||
"Precision*"{
|
||||
Return "Laptop"
|
||||
}
|
||||
"M24*" {
|
||||
return "Anesthesia Cart"
|
||||
}
|
||||
"Medix*"{
|
||||
return "Anesthesia Cart"
|
||||
}
|
||||
|
||||
Default {Return "Unknown Model/Chassis"}
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
Function Get-CMDBLocation {
|
||||
$cmdb = Get-LANDeskCMDBItem -Name $comp
|
||||
if ($null -eq $cmdb){
|
||||
$location = "*CMDB Mismatch - check CMDB*"
|
||||
return $location
|
||||
}
|
||||
$location = $cmdb.values._SHSLocation3
|
||||
if($null -eq $location -or '' -eq $location){
|
||||
$location = "*No location data - Please update CMDB*"
|
||||
}
|
||||
return $location
|
||||
}
|
||||
#>
|
||||
##STILL TESTING
|
||||
Function Get-TimeOutJob ($Command){
|
||||
|
||||
$Job = Start-Job -ScriptBlock {
|
||||
|
||||
$test1 = $Command
|
||||
|
||||
Return $test1
|
||||
|
||||
$Job | Wait-Job -Timeout 2
|
||||
$Job | Stop-Job
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Function Get-LocationDetails ($ComputerName) {
|
||||
|
||||
$cmdbRecord = Search-ISMBO -BO cis -filter "Name eq '$ComputerName'" -RawFilter
|
||||
|
||||
$LocationConstructors = @(
|
||||
"SHS_AssetLocality",
|
||||
"ivnt_Location",
|
||||
"SHS_Floor",
|
||||
"SHS_Department",
|
||||
"SHS_LocationDetails"
|
||||
)
|
||||
|
||||
$LocationData = Foreach($Loc in $LocationConstructors){
|
||||
|
||||
if ($Loc -eq 'SHS_Floor'){
|
||||
$(if ($cmdbRecord.$Loc -match '-'){$cmdbRecord.$Loc.split('-')[-1] + " Floor"} else{$cmdbRecord.$Loc})
|
||||
} elseif (![string]::IsNullOrEmpty($cmdbRecord.$Loc)){
|
||||
$cmdbRecord.$Loc
|
||||
}
|
||||
}
|
||||
|
||||
$LocationData = $LocationData -join ' | '
|
||||
|
||||
return $LocationData
|
||||
}
|
||||
|
|
@ -1,334 +0,0 @@
|
|||
#GetPC w/ Jobs
|
||||
|
||||
#CIM Instance Calls
|
||||
<#
|
||||
win32_networkadapterconfiguration | MAC Address,
|
||||
win32_computersystem | Username, Model, RAM,
|
||||
win32_LogicalDisk | Diskspace,
|
||||
win32_bios | ServiceTag, Bios Version,
|
||||
win32_OperatingSystem | Last Restart, OS Version, OS Build, OS Build Number
|
||||
win32_SystemEnclosure | Asset Tag
|
||||
win32_processor | CPU Type
|
||||
PC Release ID
|
||||
Installed Printers
|
||||
#>
|
||||
|
||||
#WMI Calls
|
||||
<#
|
||||
win32_tpm
|
||||
#>
|
||||
|
||||
#PSSessions
|
||||
<#
|
||||
Lastuser/Lastuser timestamp
|
||||
Imprivata Type
|
||||
Kiosk Role and Type
|
||||
MBAM GPO Status
|
||||
#>
|
||||
|
||||
<#
|
||||
function get-PCremoteCleaned {
|
||||
param (
|
||||
[string]$comp,
|
||||
$connection,
|
||||
$NumberofComputers,
|
||||
$PCID
|
||||
)
|
||||
|
||||
$ComputerName = $Comp
|
||||
|
||||
$i = 0
|
||||
$i++ | ProgressBar $i $comp 'NetAdapter' $NumberofComputers $PCID
|
||||
$win32_networkadapterconfiguration = Get-CimInstance -Class win32_networkadapterconfiguration -ComputerName $ComputerName #| MAC Address,
|
||||
$i++ | ProgressBar $i $comp 'LogicalDisk' $NumberofComputers $PCID
|
||||
$win32_LogicalDisk = Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3" -ComputerName $ComputerName #| Diskspace,
|
||||
$i++ | ProgressBar $i $comp 'Enclosure' $NumberofComputers $PCID
|
||||
$win32_SystemEnclosure = Get-CimInstance -ClassName Win32_SystemEnclosure -ComputerName $ComputerName #| Asset Tag
|
||||
$i++ | ProgressBar $i $comp 'Bitlocker' $NumberofComputers $PCID
|
||||
$bitlocker = manage-bde -cn $ComputerName -status C: # | Bitlocker Status
|
||||
$i++ | ProgressBar $i $comp 'PCInfo' $NumberofComputers $PCID
|
||||
$PCInfo = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {get-computerinfo}
|
||||
$i++ | ProgressBar $i $comp 'PhysicalDisk' $NumberofComputers $PCID
|
||||
$physicalDisk = Get-PhysicalDisk -CimSession $ComputerName # | Disk Type
|
||||
$i++ | ProgressBar $i $comp 'Printers' $NumberofComputers $PCID
|
||||
$win32_printer = (Get-CimInstance -ClassName win32_printer -ComputerName $ComputerName | Where-Object {$_.PortName -ne 'PORTPROMPT:' -and $_.PortName -ne 'nul:' -and $_.PortName -ne 'SHRFAX:'} | Select-Object -ExpandProperty Name) -join ' || ' # | Printers
|
||||
$i++ | ProgressBar $i $comp 'Imprivata' $NumberofComputers $PCID
|
||||
$imprivataRegEntry = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SSOProvider\ISXAgent}
|
||||
$kioskRegEntry = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\SHSCustom}
|
||||
$i++ | ProgressBar $i $comp 'TPM' $NumberofComputers $PCID
|
||||
$win32_tpm = Get-CimInstance -Namespace root\cimv2\security\microsofttpm -Class win32_tpm -ComputerName $ComputerName # | TPM
|
||||
$i++ | ProgressBar $i $comp 'MBAM GPO' $NumberofComputers $PCID
|
||||
$gpostatus = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock{
|
||||
|
||||
$gpoPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\FVE\MDOPBitLockerManagement"
|
||||
$gpoValue = Get-ItemPropertyValue -Path $gpoPath -Name "KeyRecoveryServiceEndPoint"
|
||||
|
||||
Switch($GpoValue -eq "https://shsmbam1.int.samhealth.net/MBAMRecoveryAndHardwareService/CoreService.svc")
|
||||
{
|
||||
$true {$gpoStatus = "GPO Applied"}
|
||||
$false {$gpoStatus = "GPO Not Applied (Check if system is member of group MBAM_Default on ADUC"}
|
||||
Default {$gpoStatus = "Error...GPOTEST Line PCRemote Line 276"}
|
||||
}
|
||||
Return $gpoStatus
|
||||
}
|
||||
$i++ | ProgressBar $i $comp 'Pulling Citrix' $NumberofComputers $PCID
|
||||
$CitrixViewer = "\\$ComputerName\C$\Program Files (X86)\Citrix\ICA Client\CDViewer.exe"
|
||||
$i++ | ProgressBar $i $comp 'Pulling Last users' $NumberofComputers $PCID
|
||||
$LastUser = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock {
|
||||
Get-ChildItem -Path C:\Users -Directory -Force -Exclude Public,Default,'Default User','All Users' |
|
||||
Sort-Object -Property LastWriteTime -Descending | Select-Object -First 3} # | Last Users
|
||||
$i++ | ProgressBar $i $comp 'Pulling CPU' $NumberofComputers $PCID
|
||||
$CPU = (Get-CimInstance -ClassName Win32_processor -ComputerName $ComputerName).Name
|
||||
#CMDB Location
|
||||
$i++ | ProgressBar $i $comp 'Pulling CMDB Data' $NumberofComputers $PCID
|
||||
$location = Get-CMDBLocation $ComputerName
|
||||
|
||||
$i++ | ProgressBar $i $comp 'Compiling Data' $NumberofComputers $PCID
|
||||
#MAC Address
|
||||
$MAC = ($win32_networkadapterconfiguration | Where-Object {$_.IpEnabled -Match "True"} | Select-Object -Expand macaddress) -join ","
|
||||
|
||||
#IP
|
||||
$ip = $connection.IPV4Address
|
||||
#UserName
|
||||
$Username = $PCInfo.CSUserName
|
||||
if($null -eq $Username){
|
||||
|
||||
$Username = (Invoke-Command -SessionOption (New-PSSessionOption -NoMachineProfile) -ComputerName $ComputerName -ScriptBlock {Get-Process Explorer -IncludeUsername | Where-Object { $_.Username -notlike "*SYSTEM" }} ).Username
|
||||
|
||||
if($null -ne $Username){
|
||||
$Username = "$Username (RDP/Inactive)"
|
||||
}
|
||||
else{
|
||||
$Username = '**None**'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Last User
|
||||
if($lastUser.Count -gt 1){
|
||||
|
||||
$lastUser1 = ($lastUser[0].Name + " (" + $lastUser[0].LastWriteTime + ")")
|
||||
$lastUser2 = ($lastUser[1].Name + " (" + $lastUser[1].LastWriteTime + ")")
|
||||
$lastUser3 = ($lastUser[2].Name + " (" + $lastUser[2].LastWriteTime + ")")
|
||||
|
||||
$TotalLastUsers = "$lastUser1 $lastUser2 $lastUser3"
|
||||
|
||||
}else{
|
||||
|
||||
$TotalLastUsers = $lastUser.Name + " (" + $lastUser.LastWriteTime + ")"
|
||||
}
|
||||
#ComputerModel
|
||||
$compModel = $PCInfo.CsModel
|
||||
|
||||
#RAM
|
||||
$ram = $PCInfo.CsTotalPhysicalMemory
|
||||
$ram = [math]::Round(($ram / 1GB))
|
||||
$ram = "$ram" + ' GB'
|
||||
|
||||
#Drive Type
|
||||
$DriveType = $physicalDisk.MediaType
|
||||
|
||||
#Free Harddrive Space
|
||||
$CompFreeSpace = @([math]::Round($win32_LogicalDisk.FreeSpace / 1gb,2),[math]::Round($win32_LogicalDisk.Size / 1gb,2))
|
||||
$free = $compFreeSpace[0]
|
||||
$max = $compfreeSpace[1]
|
||||
$freespace = "$free GB / $max GB"
|
||||
|
||||
|
||||
#Service Tag
|
||||
#$serviceTag = $win32_bios.SerialNumber
|
||||
$serviceTag = $PCInfo.BiosSeralNumber
|
||||
#BIOS
|
||||
#$biosVersion = $win32_bios.SMBIOSBIOSVersion
|
||||
$biosVersion = $PCInfo.BiosName
|
||||
|
||||
#Last Reboot
|
||||
$lastbootTime = $PCInfo.OsLastBootUpTime
|
||||
|
||||
#Asset Tag
|
||||
$assetTag = $win32_SystemEnclosure.SMBiosAssetTag
|
||||
|
||||
#Bitlocker Status
|
||||
$PercentageEncrypted = (($bitlocker | Select-String "Percentage Encrypted") -split ': ')[1]
|
||||
[int]$IntPercentageEncrypted = $PercentageEncrypted.Substring(0,4)
|
||||
$EncryptionStatus = $null
|
||||
If($bitlocker -like '*error*')
|
||||
{
|
||||
$EncryptionStatus = 'BitLocker - Error - Please investigate'
|
||||
}
|
||||
Elseif($IntPercentageEncrypted -eq 100)
|
||||
{
|
||||
$EncryptionStatus = "BitLocker - Encrypted ($PercentageEncrypted)"
|
||||
}
|
||||
ElseIf($IntPercentageEncrypted -gt 1)
|
||||
{
|
||||
$EncryptionStatus = "BitLocker - Encrypting ($PercentageEncrypted)"
|
||||
}
|
||||
Else
|
||||
{
|
||||
$EncryptionStatus = "BitLocker - Decrypted ($PercentageEncrypted)"
|
||||
}
|
||||
|
||||
#OS
|
||||
$os = $PCInfo.OSName + " (" + $PCInfo.OSArchitecture + ")"
|
||||
|
||||
#OS Build
|
||||
$osVer = $PCInfo.WindowsVersion
|
||||
$osBuild = $PCInfo.OSBuildNumber
|
||||
$osBuild = "Vers $osVer | Build #$osBuild"
|
||||
|
||||
#Printers
|
||||
$printers = $win32_printer# ($win32_printer | Where-Object {$_.PortName -ne 'PORTPROMPT:' -and $_.PortName -ne 'nul:' -and $_.PortName -ne 'SHRFAX:'} | Select-Object -ExpandProperty Name) -join ' || '
|
||||
if(!$printers){
|
||||
$printers = "No Local/Networked Printer (Check Printer Mappings)"
|
||||
}
|
||||
|
||||
#Imprivata
|
||||
$ImprivataType = $imprivataRegEntry | Select-Object -ExpandProperty Type
|
||||
if(!$imprivataType){
|
||||
$ImprivataType = "Not Installed"
|
||||
}
|
||||
else{
|
||||
Switch($ImprivataType){
|
||||
1 {
|
||||
$ImprivataType = $imprivataRegEntry | Select-Object -ExpandProperty FUS_Enabled
|
||||
Switch($ImprivataType){
|
||||
0 {$ImprivataType = "SUD"}
|
||||
1 {$ImprivataType = "MUD"}
|
||||
}
|
||||
}
|
||||
2 {$ImprivataType = "Kiosk"}
|
||||
Default {$ImprivataType = "Not Installed"}
|
||||
}
|
||||
}
|
||||
$kioskRole = $kioskRegEntry | Select-Object -ExpandProperty KioskRole
|
||||
if(!$kioskRole){
|
||||
$kioskRole = "None"
|
||||
}
|
||||
|
||||
#TPM
|
||||
$tpmStatus = $win32_tpm | Select-Object -ExpandProperty IsEnabled_InitialValue
|
||||
if($tpmStatus -eq $true){
|
||||
$tpmStatus = "On & Activated"
|
||||
}
|
||||
elseif($tpmStatus -eq $false){
|
||||
$tpmStatus = "On & Deactivated"
|
||||
}
|
||||
else{
|
||||
$tpmStatus = "TPM Off"
|
||||
}
|
||||
|
||||
#Chassis Type
|
||||
$chassisType = Get-ChassisTypeNew -CPU $CPU -Model $compModel
|
||||
|
||||
#Citrix Version
|
||||
if( !(Test-path $CitrixViewer)){
|
||||
|
||||
$CitrixVersion = "Not Installed"
|
||||
}
|
||||
else{
|
||||
#Checks this default install path
|
||||
$CitrixVersion = Get-Command $citrixViewer | select-object -ExpandProperty Version #Grabs Citrix version number
|
||||
}
|
||||
|
||||
|
||||
#Output
|
||||
$i++ | ProgressBar $i $comp 'Generating Output' $NumberofComputers $PCID
|
||||
$props = [Ordered]@{
|
||||
Hostname = "$comp"
|
||||
Status = "Online"
|
||||
'Current User' = "$userName"
|
||||
'Last User(s)' = "$TotalLastUsers"
|
||||
'IP | MAC' = "$ip | $mac"
|
||||
Model = "$compModel ($chassisType)"
|
||||
'OS' = $os
|
||||
'OS Build' = $osBuild
|
||||
'BIOS Ver' = "$biosVersion"
|
||||
Encryption = "$EncryptionStatus"
|
||||
'Free Space' = "$freespace | $driveType"
|
||||
RAM = "$ram"
|
||||
'SSO Client' = "$imprivataType"
|
||||
'Kiosk Role' = "$kioskRole"
|
||||
'Citrix Ver' = "$citrixVersion"
|
||||
'Asset Tag' = "$assetTag"
|
||||
'Service Tag' = "$serviceTag"
|
||||
'Last Reboot' = "$lastbootTime"
|
||||
'TPM Status' = "$tpmStatus"
|
||||
'MBAM GPO' = "$gpostatus"
|
||||
Printers = "$printers"
|
||||
'CMDB Location' = "$location"
|
||||
}
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
||||
return $obj
|
||||
}
|
||||
#Helper Functions
|
||||
|
||||
Function Get-ChassisTypeNew {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
$CPU,
|
||||
$Model
|
||||
)
|
||||
Switch -Wildcard($Model)
|
||||
{
|
||||
"Optiplex*" {
|
||||
Switch -Wildcard($CPU)
|
||||
{
|
||||
"Intel(R) Core(TM) i5-6500 CPU*" {Return "SFF"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i5-6500T*" {Return "Micro"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i7-6700 CPU*" {Return "SFF"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i7-6700T*" {Return "Micro"} #7040
|
||||
|
||||
"Intel(R) Core(TM) i5-9500T*" {Return "Micro"} #5070
|
||||
|
||||
"Intel(R) Core(TM) i5-8500 CPU*" {Return "SFF"} #5060
|
||||
|
||||
"Intel(R) Core(TM) i5-8500T*" {Return "Micro"} #5060
|
||||
|
||||
"Intel(R) Core(TM) i5-7500*" {Return "SFF"} #5050
|
||||
|
||||
"Intel(R) Core(TM) i5-4670 CPU*" {Return "SFF"} #9020
|
||||
|
||||
"Intel(R) Core(TM) i5-4590 CPU*" {Return "SFF"} #9020
|
||||
|
||||
"Intel(R) Core(TM) i5-4590T CPU*" {Return "Micro"} #9020M
|
||||
|
||||
"Intel(R) Core(TM) i5-4690 CPU*" {Return "SFF"} #9020
|
||||
|
||||
"Intel(R) Core(TM) i5-3550 CPU*" {Return "SFF"} #9010
|
||||
|
||||
"Intel(R) Core(TM) i5-2400 CPU*" {Return "SFF"} #990
|
||||
|
||||
Default {Return "Optiplex - Chassis Type - Unknown"}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
"Latitude*" {
|
||||
Return "Laptop"
|
||||
}
|
||||
"Precision*"{
|
||||
Return "Laptop"
|
||||
}
|
||||
|
||||
Default {Return "Unknown Model/Chassis"}
|
||||
}
|
||||
}
|
||||
|
||||
Function Get-CMDBLocation($comp) {
|
||||
$cmdb = Get-LANDeskCMDBItem -Name $comp
|
||||
if ($null -eq $cmdb){
|
||||
$location = "*CMDB Mismatch - check CMDB*"
|
||||
return $location
|
||||
}
|
||||
$location = $cmdb.values._SHSLocation3
|
||||
if($null -eq $location -or '' -eq $location){
|
||||
$location = "*No location data - Please update CMDB*"
|
||||
}
|
||||
return $location
|
||||
}
|
||||
#>
|
||||
|
|
@ -93,6 +93,25 @@ Function Get-SCCMQuery {
|
|||
Write-Progress -Activity "Getting SCCM data for $comp" -Status 'Querying for CMDB data' -PercentComplete 95 -ParentId 1
|
||||
$cmdbData = Search-ISMBO -bo cis -Filter "Name eq $comp" -RawFilter
|
||||
|
||||
$LocationConstructors = @(
|
||||
"SHS_AssetLocality",
|
||||
"ivnt_Location",
|
||||
"SHS_Floor",
|
||||
"SHS_Department",
|
||||
"SHS_LocationDetails"
|
||||
)
|
||||
|
||||
$LocationData = Foreach($Loc in $LocationConstructors){
|
||||
|
||||
if ($Loc -eq 'SHS_Floor'){
|
||||
$(if ($cmdbData.$Loc -match '-'){$cmdbData.$Loc.split('-')[-1] + " Floor"} else{$cmdbData.$Loc})
|
||||
} elseif (![string]::IsNullOrEmpty($cmdbData.$Loc)){
|
||||
$cmdbData.$Loc
|
||||
}
|
||||
}
|
||||
|
||||
$LocationData = $LocationData -join ' | '
|
||||
|
||||
if($FindLastHardwareScanSCCM){
|
||||
Write-Host "`n`nPulling cached SCCM data for $comp." -ForegroundColor Yellow
|
||||
Write-Host "Last Hardware Scan Time: $FindLastHardwareScanSCCM" -ForegroundColor Yellow
|
||||
|
|
@ -119,6 +138,8 @@ Function Get-SCCMQuery {
|
|||
'Service Tag' = "$FindServiceTagSCCM"
|
||||
'Last Reboot' = "$FindLastBootUpTimeSCCM"
|
||||
Printers = "$FindPCPrinterSCCM"
|
||||
'CMDB Location' = "$LocationData"
|
||||
'CMDB Status' = $cmdbData.Status
|
||||
}
|
||||
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ $SCCMNAMESPACE="root\sms\site_100"
|
|||
'Last Reboot' = "$FindLastBootUpTimeSCCM"
|
||||
Printers = "$FindPCPrinterSCCM"
|
||||
'CMDB Location' = "$LocationData"
|
||||
'CMDB Status' = $cmdbData.Status
|
||||
}
|
||||
|
||||
$obj = New-Object -TypeName PSObject -Property $props
|
||||
|
|
|
|||
|
|
@ -153,6 +153,23 @@ function Get-SHSPrinter {
|
|||
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)'}
|
||||
}
|
||||
}
|
||||
$model = "Zebra $model"
|
||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2
|
||||
#STATUS
|
||||
|
|
|
|||
|
|
@ -1,9 +1,25 @@
|
|||
# Many printers only have self-signed ssl certs. This type is used to
|
||||
# disable the ssl checking (basically clicking "Proceed to unsecure website")
|
||||
if (-not ([System.Management.Automation.PSTypeName]'TrustAllCertsPolicy').Type) {
|
||||
add-type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
}
|
||||
|
||||
function ScanToEmail {
|
||||
param (
|
||||
[string]$printer
|
||||
)
|
||||
|
||||
$DNSServers = @{
|
||||
$DNSServers = [ordered]@{
|
||||
'Sam Square/Walnut' = @{
|
||||
'Primary' = '10.98.2.45'
|
||||
'Secondary' = '10.98.2.74'
|
||||
|
|
@ -30,6 +46,8 @@ function ScanToEmail {
|
|||
}
|
||||
}
|
||||
|
||||
$SMTPServer = "shssmtp01.int.samhealth.net"
|
||||
|
||||
<#
|
||||
Typically SNMP is set to read-only on most printers so we'll have to
|
||||
replicate web requests. There isn't really a standard so this support
|
||||
|
|
@ -40,7 +58,108 @@ function ScanToEmail {
|
|||
$printerip = (Resolve-DnsName $printer).IPAddress
|
||||
$snmp.open($printerip, 'public', 2, 3000)
|
||||
try { $model = $snmp.Get('.1.3.6.1.2.1.25.3.2.1.3.1') } catch { $model = $null }
|
||||
switch -Regex ($model) {
|
||||
'^HP LaserJet Pro M404n' { $function:ScanToEmailHPLJM400}
|
||||
$ModelSetupFunction = switch -Regex ($model) {
|
||||
'^HP LaserJet MFP M5\d\d' { $function:ScanToEmailHPFutureSmart }
|
||||
'^HP LaserJet MFP M6\d\d' { $function:ScanToEmailHPFutureSmart }
|
||||
default { $null }
|
||||
}
|
||||
if ($null -eq $ModelSetupFunction) {
|
||||
Write-Host -ForegroundColor Yellow "Printer model $model not supported at this time. Manual configuration required."
|
||||
return
|
||||
}
|
||||
for ($i = 0; $i -lt $DNSServers.Count; $i++) {
|
||||
Write-Host "[$i] $($DNSServers[$i])"
|
||||
}
|
||||
[int]$site = Read-Host "Select site: "
|
||||
if ($null -eq $site) {
|
||||
Write-Host -ForegroundColor Yellow "Unsupported site selected"
|
||||
return
|
||||
}
|
||||
& $ModelSetupFunction $printer.DomainName $DNSServers.$site
|
||||
}
|
||||
|
||||
# hp 400 series mfps
|
||||
Function ScanToEmailHPLJM400 {
|
||||
param (
|
||||
[string]$PrinterDomainName,
|
||||
$DNSServers
|
||||
)
|
||||
# No server certificate so overwrite checking
|
||||
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
|
||||
Invoke-WebRequest "https://$PrinterDomainName/IoMgmt/Adapters/Eth0/Profiles/Active" -Method PUT -Body @"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<io:Profile xmlns:io="http://www.hp.com/schemas/imaging/con/ledm/iomgmt/2008/11/30" xmlns:dd="http://www.hp.com/schemas/imaging/con/dictionaries/1.0/" xmlns:wifi="http://www.hp.com/schemas/imaging/con/wifi/2009/06/26" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.hp.com/schemas/imaging/con/ledm/iomgmt/2008/11/30 ../../schemas/IoMgmt.xsd http://www.hp.com/schemas/imaging/con/dictionaries/1.0/ ../../schemas/dd/DataDictionaryMasterLEDM.xsd">
|
||||
<io:NetworkProfile>
|
||||
<io:IPv4Network>
|
||||
<dd:DNSServerIPAddress>
|
||||
$($DNSServers.Primary)
|
||||
</dd:DNSServerIPAddress>
|
||||
<dd:SecondaryDNSServerIPAddress>
|
||||
$($DNSServers.Secondary)
|
||||
</dd:SecondaryDNSServerIPAddress>
|
||||
</io:IPv4Network>
|
||||
</io:NetworkProfile>
|
||||
</io:Profile>
|
||||
"@ -ContentType 'text/xml'
|
||||
}
|
||||
|
||||
# HP printers with Future Smart firmware
|
||||
# Developed for HP FutureSmart 5
|
||||
# Tested on
|
||||
# 5.4
|
||||
Function ScanToEmailHPFutureSmart {
|
||||
param (
|
||||
[string]$PrinterDomainName,
|
||||
$DNSServers
|
||||
)
|
||||
$printerName = if ($PrinterDomainName -match '^[^.]*(?=\.)') { $Matches[0] }
|
||||
$printerEmail = "$printerName@samhealth.org"
|
||||
|
||||
# No server certificate so overwrite checking
|
||||
$savePolicy = [System.Net.ServicePointManager]::CertificatePolicy
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
$res = Invoke-WebRequest "https://$PrinterDomainName/network_id.htm" -Method GET -SessionVariable WebSession
|
||||
if ($res.Content -match 'id="CSRFToken".*VALUE="(.+)"') { $CSRFToken = [uri]::EscapeDataString($Matches[1]) }
|
||||
|
||||
Invoke-WebRequest "https://$PrinterDomainName/network_id.htm/config" `
|
||||
-Method POST `
|
||||
-WebSession $WebSession `
|
||||
-ContentType 'application/x-www-form-urlencoded' `
|
||||
-Body "IPv4_DnsServerId=$($DNSServers.Primary)&IPv4_Sec_DnsServerId=$($DNSServers.Secondary)&Apply=Apply&CSRFToken=$CSRFToken"
|
||||
|
||||
#New csrf token?
|
||||
#$res = Invoke-WebRequest "https://$PrinterDomainName/hp/device/BasicSend/Index" -Method GET -SessionVariable WebSession
|
||||
#if ($res.Content -match 'id="CSRFToken".*VALUE="(.+)"') { $CSRFToken = [uri]::EscapeDataString($Matches[1]) }
|
||||
|
||||
# Enable smtp and set email
|
||||
Invoke-WebRequest "https://$PrinterDomainName/hp/device/BasicSend/Save" `
|
||||
-Method POST `
|
||||
-WebSession $WebSession `
|
||||
-ContentType 'application/x-www-form-urlencoded' `
|
||||
-Body "FilterUsage=SendToEmail&EmailFromAddress=$printerEmail&FormButtonSubmit=Apply&CSRFToken=$CSRFToken"
|
||||
|
||||
# Set smtp server
|
||||
Invoke-WebRequest "https://$PrinterDomainName/hp/device/SmtpWizard/Save" `
|
||||
-Method POST `
|
||||
-WebSession $WebSession `
|
||||
-ContentType 'application/x-www-form-urlencoded' `
|
||||
-Body "FilterUsage=SendToEmail&StepId=4&SmtpSelection=1&SmtpServerName=$SMTPServer&SmtpServerPort=25&SmtpSplitEmail=0&FormButtonSubmit=Next&CSRFToken=$CSRFToken"
|
||||
|
||||
# Set authentication (none)
|
||||
Invoke-WebRequest "https://$PrinterDomainName/hp/device/SmtpWizard/Save" `
|
||||
-Method POST `
|
||||
-WebSession $WebSession `
|
||||
-ContentType 'application/x-www-form-urlencoded' `
|
||||
-Body "FilterUsage=SendToEmail&StepId=5&SmtpAuthentication=False&FormButtonSubmit=Next&CSRFToken=$CSRFToken"
|
||||
|
||||
# Set usage (just scan to email)
|
||||
Invoke-WebRequest "https://$PrinterDomainName/hp/device/SmtpWizard/Save" `
|
||||
-Method POST `
|
||||
-WebSession $WebSession `
|
||||
-ContentType 'application/x-www-form-urlencoded' `
|
||||
-Body "FilterUsage=SendToEmail&StepId=6&SmtpUsage=SendToEmail&FormButtonSubmit=Next&CSRFToken=$CSRFToken"
|
||||
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = $savePolicy
|
||||
}
|
||||
|
|
@ -35,9 +35,11 @@ if ($Version -ne $deployedVersion) {
|
|||
elseif ($devStage -eq "Dev") {
|
||||
if ($getPCDevBuildPath -match '^(.*)\\[^\\]+$') { $getPCPatchNotesPath = "$($Matches[1])\patchnotes.txt" }
|
||||
}
|
||||
#Print out the most recent patch notes entry
|
||||
$patchNotes = Get-Content $getPCPatchNotesPath
|
||||
$msg = ''
|
||||
foreach ($line in $patchNotes) {
|
||||
#Matches an empty line that may contain whitespace
|
||||
if ($line -match '^\s*$') { break }
|
||||
$msg += " $line`n"
|
||||
}
|
||||
|
|
@ -61,6 +63,7 @@ Function Get-PC {
|
|||
-CMDB | only queries CMDB for info
|
||||
-Devices | shows connected monitors and usb devices
|
||||
-DevicesUnplugged | shows unplugged devices like scanners and printers
|
||||
-Enable | re-enable computer account in AD
|
||||
-EventLog | pulls up errors in the event log for the last x days
|
||||
-Excel | exports collected data to csv and opens it with excel
|
||||
-Filesystem | access the file system
|
||||
|
|
@ -110,8 +113,10 @@ Function Get-PC {
|
|||
[Switch]$Bypass,
|
||||
[Switch]$ClearCCMCache,
|
||||
[Switch]$CMDB,
|
||||
[Switch]$CMDBWeb,
|
||||
[switch]$Devices,
|
||||
[switch]$DevicesUnplugged,
|
||||
[switch]$Enable,
|
||||
[Switch]$EventLog,
|
||||
[switch]$Excel,
|
||||
[Switch]$FileSystem,
|
||||
|
|
@ -184,7 +189,7 @@ Function Get-PC {
|
|||
if ($PatchNotes) {
|
||||
$scriptparent = (get-item $PSScriptRoot ).parent.FullName
|
||||
Write-Host "`n"
|
||||
Get-Content $scriptparent\patchnotes.txt
|
||||
Get-Content $scriptparent\patchnotes.txt
|
||||
break
|
||||
}
|
||||
|
||||
|
|
@ -307,6 +312,10 @@ Function Get-PC {
|
|||
$outputArray += Get-CMDBFallback $comp
|
||||
continue
|
||||
}
|
||||
if ($CMDBWeb) {
|
||||
Invoke-CMDBWebLaunch $comp
|
||||
break
|
||||
}
|
||||
|
||||
#DREW SUCKS
|
||||
|
||||
|
|
@ -355,6 +364,21 @@ Function Get-PC {
|
|||
Invoke-Wake $comp
|
||||
continue
|
||||
}
|
||||
|
||||
if ($Enable) {
|
||||
if (-not ( Get-Module -ListAvailable -Name 'ActiveDirectory') ) {
|
||||
Write-Warning 'Active Drirectory Thick Client is required for this function'
|
||||
break
|
||||
}
|
||||
$comp | Get-ADComputer | Enable-ADAccount
|
||||
if (Get-ADUser -Filter "Name -like 'K_$comp'") {
|
||||
Write-Host -ForegroundColor Yellow "Kiosk account found. Please re-kiosk this workstation."
|
||||
} else {
|
||||
Add-ADGroupMember -Identity (Get-ADGroup -Identity 'CN=SSO Workstations') -Members (Get-ADComputer $comp)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
#PING HERE - All commands after here either require the computer to be online or need to know
|
||||
#------------------------------------------------------------------------------------------------------------------------------------------------------------------#
|
||||
|
|
@ -618,10 +642,14 @@ Function Get-PC {
|
|||
#checks to see if the computer is in AD or the disabled computers OU and warns the user
|
||||
if (get-module -ListAvailable -Name 'ActiveDirectory') {
|
||||
Write-Progress -Activity "Get-PC flags processing" -Status "Looking up $comp in AD ($PCID/$NumberofComputers)" -PercentComplete ($PCID*100/$NumberOfComputers) -Id 1
|
||||
try { $adTest = ((Get-ADComputer $comp).DistinguishedName -match "Disabled Computers") } catch { $adTest = $true }
|
||||
|
||||
if ($adTest) {
|
||||
Write-Warning "$comp is either disabled or off the domain"
|
||||
try {
|
||||
$adTest = ((Get-ADComputer $comp).DistinguishedName -match "Disabled Computers")
|
||||
if ($adTest) {
|
||||
Write-Warning "$comp is disabled"
|
||||
Write-Warning "Run 'Get-PC $comp -Enable' to attempt to re-enable"
|
||||
}
|
||||
} catch {
|
||||
Write-Warning "$comp is off the domain"
|
||||
if ($SoundEnabled) {
|
||||
$oopsSoundPath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\xfiles.wav'
|
||||
(New-Object Media.SoundPlayer $oopsSoundPath).Play()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
Hi, I'm the patch notes, nice to meet you! You can find me with the -PatchNotes flag.
|
||||
These are the changes in the most recent update of Get-PC
|
||||
Patch: 2024-09
|
||||
-Fix no more functions create a profile on the remote machine
|
||||
-Add Zebra GK420d and ZD421 report ip config mode in shsprinter
|
||||
-Fix spelling error in progress bars ("stoarge" smh)
|
||||
-Add CMDBWeb flag to open the CMDB web page.
|
||||
-Fix CMDB flag pulls cmdb data
|
||||
-Fix Distinguishes between disabled and off-domain computers
|
||||
-Add Enable flag to enable disabled computers
|
||||
-Add CMDB Status field to decrease ambiguity (though CMDB-Fallback assumes workstation is offline)
|
||||
|
||||
Patch: 2024-09-23
|
||||
-Add SHSPrinter IP indicates config method (dhcp, manual, etc.)
|
||||
-Fix hostname search ends early if user supplied a correct hostname to get-pc (prevents recently changed hostname from failing)
|
||||
|
|
|
|||
Loading…
Reference in a new issue