Skip to content

Instantly share code, notes, and snippets.

$ErrorActionPreference = 'SilentlyContinue'
$VerbosePreference = 'Continue'
$ProgressPreference = 'SilentlyContinue'
Start-Transcript -OutputDirectory c:\prep
$partitionsize = (Get-PartitionSupportedSize -DriveLetter "C")
$size = Get-Partition -DriveLetter "C"
if ($partitionsize.SizeMax -ne $size.size) { Resize-Partition -DriveLetter "C" -Size $partitionsize.SizeMax }
Install-PackageProvider -Name NuGet -Force
$modulestoInstall = @('cChoco')
resource "azapi_resource_action" "stop-vm" {
count = var.rdsh_count
type = "Microsoft.Compute/virtualMachines@2024-03-01"
resource_id = azurerm_windows_virtual_machine.avd_vm.*.id[count.index]
action = "deallocate"
response_export_values = ["*"]
depends_on = [
azurerm_virtual_machine_extension.boot_strap
]
}
Get-AzVM | `
where-object {$_.storageprofile.Osdisk.OSType -eq 'Linux'} | `
ForEach-Object {$out = @()} {$a = [pscustomobject]@{Name = $_.Name; Version = (Get-azVM -status -VMName $_.Name -ResourceGroupName $_.ResourceGroupName).Extensions.Where({$_.Name -match 'OMS'}).TypeHandlerVersion; ResourceGroupName = $_.ResourceGroupName}; $out+=$a}; $out
# Retrieve all Public IPs
$AllPublicIPs = Get-AzureRMPublicIPaddress
# Retrieve all Virtual Networks
$vnetall = Get-AzureRMVirtualNetwork
# Retrieve all Network Interfaces
$nicall = Get-AzureRmNetworkInterface
# Retrieve all ARM Virtual Machines
$AllVMs = Get-AzureRMVM | Sort-object location, resourcegroupname, name
$StatusForAllVms = Get-azureRmVM -Status
{"SchemaVersion":"1.10","RunbookDefinition":"AAEAAAD/////AQAAAAAAAAAMAgAAAGJPcmNoZXN0cmF0b3IuR3JhcGhSdW5ib29rLk1vZGVsLCBWZXJzaW9uPTcuMy4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49MzFiZjM4NTZhZDM2NGUzNQUBAAAALE9yY2hlc3RyYXRvci5HcmFwaFJ1bmJvb2suTW9kZWwuR3JhcGhSdW5ib29rBQAAAApwYXJhbWV0ZXJzCmFjdGl2aXRpZXMFbGlua3MIY29tbWVudHMLb3V0cHV0VHlwZXMDAwMDA7IBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tPcmNoZXN0cmF0b3IuR3JhcGhSdW5ib29rLk1vZGVsLlBhcmFtZXRlciwgT3JjaGVzdHJhdG9yLkdyYXBoUnVuYm9vay5Nb2RlbCwgVmVyc2lvbj03LjMuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTMxYmYzODU2YWQzNjRlMzVdXbEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tPcmNoZXN0cmF0b3IuR3JhcGhSdW5ib29rLk1vZGVsLkFjdGl2aXR5LCBPcmNoZXN0cmF0b3IuR3JhcGhSdW5ib29rLk1vZGVsLCBWZXJzaW9uPTcuMy4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49MzFiZjM4NTZhZDM2NGUzNV1drQFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW09yY2hlc3RyYXRvci5HcmFwaFJ1bmJvb2suTW9kZWwuTGluaywgT3JjaGVzdHJhdG9yLkdyYXBoUnVuYm9vay5Nb2RlbCwgVmVyc2lvbj03LjMuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1Ymx
"groups": "32df13c6-6e25-48e2-9b5e-63dd25f308dd,6a06581b-64b4-4a86-a590-5bb0e1f7a63b,52d47dae-80ce-4e3c-88b5-e1d57e39506e,0c6dbf57-8196-460d-b63b-f55647179c03,4cf3860a-5d4b-4f6f-bec1-bc2bbeec5ec9,a1812dba-2d31-4a1c-9cc2-7091672defc2",
"http://schemas.microsoft.com/identity/claims/identityprovider": "live.com",
"ipaddr": "47.184.55.63",
"name": "Gregory Suvalian",
"http://schemas.microsoft.com/identity/claims/objectidentifier": "6c19805a-8757-42ae-92de-02897cd7ccf9",
"puid": "10037FFE87760F28",
"http://schemas.microsoft.com/identity/claims/scope": "user_impersonation",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "w8DgE14xt_N7LiCRKp_5Ib0OQL0G0s1lX6VUEzS95QU",
"http://schemas.microsoft.com/identity/claims/tenantid": "c0de79f3-23e2-4f18-989e-d173e1d403d6",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "live.com#artisticcheese@gmail.com",
{
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"resource": {
"properties": {
@artisticcheese
artisticcheese / requestSchema.json
Created February 15, 2019 18:43
RequestSchema
{
"properties": {
"createdDate": {
"type": "string"
},
"detailedMessage": {
"properties": {
"html": {
"type": "string"
},
pool:
vmImage: Hosted VS2017
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: scripts
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
PS D:\ntt> $nicInfo.IpConfigurations.Count
2
PS D:\ntt> $nicInfo.IpConfigurations[0]
PrivateIpAddressVersion Name Primary PrivateIpAddress PrivateIpAllocationMethod Subnet Name PublicIpAddress Name ProvisioningState
----------------------- ---- ------- ---------------- ------------------------- ----------- -------------------- -----------------
IPv4 ipconfig1 True 10.233.0.4 Dynamic Succeeded
PS D:\ntt> $nicInfo.IpConfigurations.GetType()