Skip to content

Instantly share code, notes, and snippets.

@adstep
adstep / link_multiple_devices.yaml
Created November 28, 2025 07:22 — forked from aderusha/link_multiple_devices.yaml
Select multiple entities to link their on/off state. If any selected entity is turned on or off, the other selected entities will be sent a matching on or off command.
namespace PartnerDemo
{
using Azure.Core;
using Azure.Identity;
using System.Net.Http.Headers;
using System.Reflection.PortableExecutable;
using System.Security.Cryptography.X509Certificates;
using System.Text.Json.Nodes;
internal class Program
function CreateNewLocalUser([string]$user, [string]$pass) {
Write-Host "Validating local user '$user' exists"
if ($null -eq (Get-LocalUser | Where-Object {$_.Name -eq $user})) {
Write-Host "Creating local user '$user'"
$securePass = ConvertTo-SecureString $pass -AsPlainText -Force
New-LocalUser -Name $user -Password $securePass -FullName "DevTest Lab User" -Description "DevTest Lab Test Account" | Out-Null
} else {
Write-Host "Local user '$user' already exists"
}
}
@adstep
adstep / list-hardware-devices.ps1
Created November 13, 2022 00:12
List Hardware Devices on Windows
$soundDevices = Get-CimInstance win32_sounddevice
if ($soundDevices -eq $null)
{
Write-Host "No SoundDevices"
}
foreach ($soundDevice in $soundDevices)
{
Write-Host "SoundDevice Name: $($soundDevice.Name) Description: $($soundDevice.Description)"
}
$newNetworkWindowPath = "HKLM:\System\CurrentControlSet\Control\Network\NewNetworkWindowOff"
Write-Host "Validating NewNetworkWindowOff Path exists"
if ($false -eq $(Test-Path $newNetworkWindowPath))
{
Write-Host "Creating NewNetworkWindowOff Registry Path"
New-Item -Path $newNetworkWindowPath -ItemType Key | Out-Null
}
@adstep
adstep / restart-computer.ps1
Created September 8, 2022 19:03
Restart Computer
Restart-Computer -Force -Wait
@adstep
adstep / cross-job-variable.yml
Created July 19, 2022 21:27
Cross Job Variable ADO Pipeline
trigger:
- master
variables:
system.debug: true
jobs:
- job: job0
pool: 'demo-pool'
@adstep
adstep / Check-ActiveSession.ps1
Created May 11, 2022 17:56
Check Active Session
function Get-Sessions {
param(
$computerName = "localhost"
)
try
{
$sessions = qwinsta /server:$computerName
}
catch
@adstep
adstep / Check-AutoLogon.ps1
Created May 11, 2022 17:51
Check AutoLogon
function Get-RegistryValue($path, $name) {
$registryKey = (Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue)
if ($null -eq $registryKey)
{
return $null
}
return $registryKey.$name
}