Skip to content

Commit

Permalink
Added check for #Ignore O365 device in ITG notes.
Browse files Browse the repository at this point in the history
This allows manually ignoring O365 and Intune activated devices.
  • Loading branch information
chrisjantzen committed Jan 27, 2024
1 parent e52a507 commit c9d7d72
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions User Audit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2768,7 +2768,11 @@ if ($FullMatches) {
if (($O365Devices | Measure-Object).Count -gt 0) {
# Filter any devices that aren't in the Device DB and dont use our naming convention (as these may be personal devices)
$Computers = Get-DeviceDBDevices
$O365Devices = $O365Devices | Where-Object { $_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*" }
$O365Devices = $O365Devices | Where-Object {
($_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*") -and
$Contact.notes -notlike "*# Ignore O365 Device: $($_.DisplayName.Trim())*" -and
$Contact.notes -notlike "*# Ignore InTune Device: $($_.DisplayName.Trim())*"
}
}
if (($O365Devices | Measure-Object).Count -gt 0) {
$EmailOnlyDetails = "Has the following O365 Activated Devices: " + ($O365Devices.DisplayName -join ", ")
Expand All @@ -2778,7 +2782,11 @@ if ($FullMatches) {
if (($IntuneDevices | Measure-Object).Count -gt 0) {
# Filter any devices that aren't in the Device DB and dont use our naming convention (as these may be personal devices)
$Computers = Get-DeviceDBDevices
$IntuneDevices = $IntuneDevices | Where-Object { $_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*" }
$IntuneDevices = $IntuneDevices | Where-Object {
($_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*") -and
$Contact.notes -notlike "*# Ignore O365 Device: $($_.DisplayName.Trim())*" -and
$Contact.notes -notlike "*# Ignore InTune Device: $($_.DisplayName.Trim())*"
}
}
if (($IntuneDevices | Measure-Object).Count -gt 0) {
$EmailOnlyDetails = "Has the following assigned InTune Devices: " + ($IntuneDevices.DisplayName -join ", ")
Expand Down
12 changes: 10 additions & 2 deletions User_Billing_Update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,11 @@ if ($UserAudit) {
if (($O365Devices | Measure-Object).Count -gt 0) {
# Filter any devices that aren't in the Device DB and dont use our naming convention (as these may be personal devices)
$Computers = Get-DeviceDBDevices
$O365Devices = $O365Devices | Where-Object { $_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*" }
$O365Devices = $O365Devices | Where-Object {
($_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*") -and
$Contact.notes -notlike "*# Ignore O365 Device: $($_.DisplayName.Trim())*" -and
$Contact.notes -notlike "*# Ignore InTune Device: $($_.DisplayName.Trim())*"
}
}
if (($O365Devices | Measure-Object).Count -gt 0) {
$EmailOnlyDetails = "Has the following O365 Activated Devices: " + ($O365Devices.DisplayName -join ", ")
Expand All @@ -1305,7 +1309,11 @@ if ($UserAudit) {
if (($IntuneDevices | Measure-Object).Count -gt 0) {
# Filter any devices that aren't in the Device DB and dont use our naming convention (as these may be personal devices)
$Computers = Get-DeviceDBDevices
$IntuneDevices = $IntuneDevices | Where-Object { $_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*" }
$IntuneDevices = $IntuneDevices | Where-Object {
($_.DisplayName -in $Computers.Hostname -or $_.DisplayName -like "$($OrgShortName)-*") -and
$Contact.notes -notlike "*# Ignore O365 Device: $($_.DisplayName.Trim())*" -and
$Contact.notes -notlike "*# Ignore InTune Device: $($_.DisplayName.Trim())*"
}
}
if (($IntuneDevices | Measure-Object).Count -gt 0) {
$EmailOnlyDetails = "Has the following assigned InTune Devices: " + ($IntuneDevices.DisplayName -join ", ")
Expand Down
2 changes: 1 addition & 1 deletion currentversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.18.6
2.18.7

0 comments on commit c9d7d72

Please sign in to comment.