Skip to content

Commit

Permalink
Added Device wipe by ImeiAddress and MacAddress to Reset-FullDevice.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Clark committed Jan 22, 2025
1 parent 7233f13 commit 8b3bfde
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Reset-FullDevice.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
<#
.SYNOPSIS
Performs Full Device Wipe from AirWatch for a list of SerialNumbers
Performs Full Device Wipe from AirWatch for a list of SerialNumbers, ImeiNumbers, or MacAddresses
WARNING!!! This is really best for iOS only. Android Enterprise will work, however because multiple device records can share the same Serial Number, you might not wipe the record you want to if multiples exist.
macOS requires setting a device pin, which will be covered with a different script.
.DESCRIPTION
Performs Full Device Wipe from AirWatch for a list of SerialNumbers
Performs Full Device Wipe from AirWatch for a list of SerialNumbers, ImeiNumbers, or MacAddresses
WARNING!!! This is really best for iOS only. Android Enterprise will work, however because multiple device records can share the same Serial Number, you might not wipe the record you want to if multiples exist.
macOS requires setting a device pin, which will be covered with a different script.
.PARAMETER file
Path of a CSV file with a list of Serial Numbers. This is required.
.PARAMETER fileColumn
Column title in CSV file containing SerialNumber values. This is optional, with a default value of "SerialNumber".
.PARAMETER searchBy
Name of identifier to search file, default is SerialNumber. Options include "SerialNumber", "ImeiNumber", and "MacAddress".
.INPUTS
AirWatchConfig.json
Serials.csv
.OUTPUTS
NO OUTPUT CURRENTLY:Outputs a CSV log of actions
.NOTES
Version: 1.7
Version: 1.8
Author: Joshua Clark @MrTechGadget
Creation Date: 10/02/2018
Update Date: 10/14/2023
Update Date: 01/22/2025
Site: https://github.com/MrTechGadget/aw-bulkdevices-script
.EXAMPLE
.\Reset-FullDevice.ps1 -file "Devices.csv" -fileColumn "SerialNumber"
.\Reset-FullDevice.ps1 -file "Devices.csv" -fileColumn "SerialNumber" -searchBy "SerialNumber"
#>


Expand All @@ -33,7 +35,10 @@ Param(
[string]$file,

[Parameter(HelpMessage = "Name of Id column in file, default is SerialNumber")]
[string]$fileColumn = "SerialNumber"
[string]$fileColumn = "SerialNumber",

[Parameter(HelpMessage="Name of identifier to search file, default is SerialNumber. Options include SerialNumber, ImeiNumber, and MacAddress")]
[string]$searchBy = "SerialNumber"
)

Import-Module .\PSairwatch.psm1
Expand Down Expand Up @@ -68,7 +73,7 @@ if ($acknowledge -eq 0) {

foreach ($item in $list) {
Write-Progress -Activity "Deleting Devices..." -Status "Batch $($list.IndexOf($item)+1) of $($list.Count)" -CurrentOperation "$item" -PercentComplete ((($list.IndexOf($list) + 1) / ($list.Count)) * 100)
$endpointURL = "mdm/devices/commands/DeviceWipe/device/SerialNumber/${item}"
$endpointURL = "mdm/devices/commands/DeviceWipe/device/${searchBy}/${item}"
try {
$result = Send-Post -endpoint $endpointURL -body $json -version "application/json;version=2"
if ($result -ne "") {
Expand Down

0 comments on commit 8b3bfde

Please sign in to comment.