Skip to content

Instantly share code, notes, and snippets.

@desek
desek / ProcessSCSMDW.ps1
Last active November 9, 2021 16:09
Rerun all SCSM DW jobs
$smdir = (Get-ItemProperty "HKLM:\Software\Microsoft\System Center\2010\Service Manager\Setup").InstallDirectory
Import-Module "$smdir\Microsoft.EnterpriseManagement.Warehouse.Cmdlets.psd1"
$SleepTimer = 120
$JobTypes = @(
"DWMaintenance",
"MPSyncJob",
"Extract_",
"Transform.",
#!/bin/bash
docker run -d --net=host --name iota-node -p 14265:14265 -p 14777:14777/udp -p 15777:15777 -v iota.ini:/iri/iota.ini iotaledger/iri:latest
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm i -g iota-pm
# Version should be 6.3* indicating Windows Server 2012 R2
If ([System.Environment]::OSVersion.Version.ToString() -like "6.3*")
{
# Windows Product Types. Script should only run on Server OS.
# 1: Workstation
# 2: Domain Controller
# 3: Server
If ((Get-WmiObject Win32_OperatingSystem -ErrorAction SilentlyContinue).ProductType -eq 3)
{
$Disks = Get-PhysicalDisk -CanPool $true -ErrorAction SilentlyContinue
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>System.Collections.Specialized.OrderedDictionary</T>
<T>System.Object</T>
</TN>
<DCT>
<En>
<S N="Key">siteName</S>
<S N="Value">wa-test-cmn-beta1</S>
@desek
desek / Bug-Example-TemplateParameterObject.ps1
Created June 11, 2015 18:18
New-AzureResourceGroup TemplateParameterObject bug
$galleryTemplate = Get-AzureResourceGroupGalleryTemplate -Identity $galleryTemplateId
$galleryTemplateJson = Invoke-RestMethod -Uri $GalleryTemplate.DefinitionTemplatesText
$siteLocation = "westeurope","eastus" | Out-GridView -PassThru -Title 'Location'
$webAppSize = $galleryTemplateJson.parameters.sku.allowedValues | Out-GridView -PassThru -Title 'Web Application size'
$dbSize = $galleryTemplateJson.parameters.databaseSku.allowedValues | Out-GridView -PassThru -Title 'Database size'
$KeySalt = [guid]::NewGuid().Guid.Replace("-","")
$TemplateParameterObject = [ordered]@{
siteName = $webAppName
hostingPlanName = "{0}-HostingPlan" -f $webAppName
@desek
desek / Update Azure Powershell one liner.ps1
Created May 16, 2015 19:38
Update Azure Powershell one liner
iex (Invoke-RestMethod -Uri https://api.github.com/gists/dfe515f4ef0b14e6be15).files.'Update-AzurePowershell.ps1'.content
@desek
desek / Update-AzurePowershell.ps1
Last active August 29, 2015 14:21
Update Azure Powershell module with Powershell
# Get latest azure-powershell
$AzureModule = Get-Module -Name Azure* -ListAvailable
$LatestRelease = Invoke-RestMethod -Uri https://api.github.com/repos/Azure/azure-powershell/releases/latest -Method GET
If (-not($AzureModule) -or $AzureModule.Version.ToString() -ne $LatestRelease.name)
{
$Asset = $LatestRelease.assets | Where-Object {$_.name -like "*.msi"}
$OutFile = "{0}\{1}" -f $env:TEMP, $Asset.name
Invoke-WebRequest -Uri $Asset.browser_download_url -OutFile $Outfile -Method Get
Start-Process -FilePath msiexec.exe -ArgumentList @("/i $OutFile /qb") -Wait -PassThru
}
@desek
desek / aaassembliesandmodules.txt
Last active August 29, 2015 14:10
Azure Automation Assmeblies and Available Modules 2014-12-02
Scriptblock {
[appdomain]::CurrentDomain.GetAssemblies() | Format-Table ImageRuntimeVersion, FullName
Get-Module -ListAvailable | Format-Table Name, Version
}
ImageRuntimeVersion FullName
------------------- --------
v4.0.30319 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyTok...
v4.0.30319 Orchestrator.Sandbox, Version=7.2.0.0, Culture=neutral, ...
v4.0.30319 Orchestrator.Shared, Version=7.2.0.0, Culture=neutral, P...
@desek
desek / xmlconflooping.ps1
Last active August 29, 2015 14:10
XmlConf Looping
$XmlData = @'
<HostGroups>
<HostGroup Name="All Hosts">
<HostGroup Name="Oslo">
<LogicalNetworkDefinitions>
<LogicalNetworkDefinition name="LM Oslo">
<LogicalNetwork>Live Migration</LogicalNetwork>
<Subnet>192.168.5.0/24</Subnet>
<VlanID>5</VlanID>
</LogicalNetwork>
@desek
desek / assignSchedulesToRunbook.ps1
Created November 27, 2014 10:19
Assign Schedule(s) to Runbook
# Set Azure Automation Account Name
$PSDefaultParameterValues += @{"*-AzureAutomation*:AutomationAccountName"=$AzureAutomationAccount.AutomationAccountName}
# Select one Runbook
$Runbook = Get-AzureAutomationRunbook | Out-GridView -PassThru
# Select one/multiple Schedule(s)
$Schedules = Get-AzureAutomationSchedule | Out-GridView -PassThru
# Assign Schedules to Runbook