-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Install-Application and Query-Device scripts
- Loading branch information
1 parent
f1c03bf
commit c6b54bd
Showing
2 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<# | ||
.SYNOPSIS | ||
Sends an App install command to a list of devices | ||
.DESCRIPTION | ||
To do: provide better feedback/more options, choose platform first to eliminate errors selecting profiles with the exact same name. | ||
.INPUTS | ||
AirWatchConfig.json | ||
Serials.csv | ||
.OUTPUTS | ||
NO OUTPUT CURRENTLY:Outputs a CSV log of actions | ||
.NOTES | ||
Version: 1.0 | ||
Author: Joshua Clark @MrTechGadget | ||
Creation Date: 4/20/2021 | ||
Site: https://github.com/MrTechGadget/aw-bulkdevices-script | ||
.EXAMPLE | ||
Install-Application.ps1 -file .\Devices.csv -fileColumn "device_id" -appId "12345" -appType "purchased" | ||
#> | ||
|
||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory=$True,Position=0,ValueFromPipeline=$true,HelpMessage="Path to file listing Serial Numbers.")] | ||
[string]$file, | ||
|
||
[Parameter(HelpMessage="Name of Serial Number column in file, default is SerialNumber")] | ||
[string]$fileColumn = "SerialNumber", | ||
|
||
[Parameter(Mandatory=$True,HelpMessage="ID of Application")] | ||
[string]$appId, | ||
|
||
[Parameter(Mandatory=$True,HelpMessage="App Type: internal, public, or purchased")] | ||
[string]$appType | ||
) | ||
|
||
Import-Module .\PSairwatch.psm1 | ||
|
||
<# | ||
Start of Script | ||
#> | ||
|
||
$devicelist = Read-File $file $fileColumn | ||
#$OrgGroups = Get-OrgGroups | ||
#$GroupID = Select-Tag $OrgGroups | ||
#$Platform = Select-Platform | ||
|
||
#$ApplicationList = Get-Applications $GroupID $Platform | ||
#$ApplicationSelected = Select-Tag $ApplicationList | ||
$i=0 | ||
foreach ($device in $devicelist) { | ||
$i++ | ||
#Write-Progress -Activity "Installing Application" -Status "$($i) of $($devicelist.Count)" -CurrentOperation "$($device.$fileColumn)" -PercentComplete ((($i)/(@($devicelist).Count))*100) | ||
Write-Host "$i of $($deviceList.Count)" | ||
$json = '{ "DeviceId": '+ $device +' }' | ||
try { | ||
$installresults = Install-App $json $appId $appType | ||
} | ||
catch { | ||
Write-Warning "Error Installing App" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<# | ||
.SYNOPSIS | ||
Send Query Command to list of devices with a device ID | ||
.DESCRIPTION | ||
To do: provide better feedback/more options, choose platform first to eliminate errors selecting profiles with the exact same name. | ||
.INPUTS | ||
AirWatchConfig.json | ||
Serials.csv | ||
.OUTPUTS | ||
NO OUTPUT CURRENTLY:Outputs a CSV log of actions | ||
.NOTES | ||
Version: 1.0 | ||
Author: Joshua Clark @MrTechGadget | ||
Creation Date: 4/21/2021 | ||
Site: https://github.com/MrTechGadget/aw-bulkdevices-script | ||
.EXAMPLE | ||
Query-Device.ps1 -file .\devices.csv -fileColumn "device_id" | ||
#> | ||
|
||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory=$True,Position=0,ValueFromPipeline=$true,HelpMessage="Path to file listing Serial Numbers.")] | ||
[string]$file, | ||
|
||
[Parameter(HelpMessage="Name of Device ID column in file, default is device_id")] | ||
[string]$fileColumn = "device_id" | ||
) | ||
|
||
Import-Module .\PSairwatch.psm1 | ||
|
||
<# | ||
Start of Script | ||
#> | ||
|
||
$devicelist = Read-File $file $fileColumn | ||
$i=0 | ||
foreach ($device in $devicelist) { | ||
$i++ | ||
#Write-Progress -Activity "Querying Devices" -Status "$($i) of $($devicelist.Count)" -PercentComplete ((($i)/(@($devicelist).Count))*100) | ||
Write-Host "$i of $($deviceList.Count)" | ||
$json = ' ' | ||
$endpoint = "mdm/devices/$device/commands?command=DeviceQuery" | ||
try { | ||
$queryresult = Send-Post $endpoint $json | ||
} | ||
catch { | ||
Write-Host "Error sending query command" | ||
} | ||
|
||
} |