Skip to content

Instantly share code, notes, and snippets.

@broestls
broestls / deskpro_agent_api_access.md
Created April 19, 2022 21:13
Agent-level API access to DeskPro using auth tokens

Agent-level API access to DeskPro using auth tokens

Intro

You can access DeskPro using a token that allows you to access the same API endpoints programatically as you could through the GUI. As a user, you can have a single API token for your account and expire or rotate it on demand. Like all keys, your token should be protected and kept secure, as it allows access to DeskPro under your user context without 2FA. As DeskPro has a public-facing endpoint, this could potentially be used to exfiltrate sensitive data. Both fortunately and frustratingly, API tokens are short-lived, making them suitable for infrequent script runs and not much else.

Getting your token

From the main DeskPro page, click your Profile icon in the upper-right and choose Preferences. Scroll to the bottom of that panel where there is a QR code. Scan it with a phone and you'll get a URL you can use to retrieve a user token blob. Open the link and you'll get a json file that looks like this:

@broestls
broestls / Remove_VMwareTools.ps1
Last active April 28, 2024 14:05
Force removal of VMware Tools, Program Files, and Windows Services
# This script will manually rip out all VMware Tools registry entries and files for Windows 2008-2019
# Tested for 2019, 2016, and probably works on 2012 R2 after the 2016 fixes.
# This function pulls out the common ID used for most of the VMware registry entries along with the ID
# associated with the MSI for VMware Tools.
function Get-VMwareToolsInstallerID {
foreach ($item in $(Get-ChildItem Registry::HKEY_CLASSES_ROOT\Installer\Products)) {
If ($item.GetValue('ProductName') -eq 'VMware Tools') {
return @{
reg_id = $item.PSChildName;
@broestls
broestls / v2v_cfg_generator.ps1
Created December 15, 2020 03:44
Generate a VMDK -> VHDX config file for each disk in a VMware VM for use with Starwind V2V CLI
# This function creates a cfg file for Starwind V2V converter by getting VM properties from PowerCLI
# and writing out a config file per VM disk into a directory named for the VM.
# Before executing, define Env variables ESX_USERNAME, ESX_PASSWORD, HV_DEST_HOST, HV_DEST_USERNAME,
# and HV_DEST_PASSWORD
function Set-V2VConfig {
[cmdletbinding()]
Param (
[string]$Name,
[int[]]$SkipDisks,
[string]$DestVol
@broestls
broestls / tag_vcenter_entity.ps1
Last active July 15, 2020 17:43
PowerCLI: Tagging vCenter Entities, Creates new Tags if they do not exist
# Target to be tagged
$entity = ""
# Set the tags for your target here
# Empty quotes will not be set on target entity
$desired_tags = @{
class = "";
billing_owner = "";
billing_owner_email = "";