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
$blobName = "" | |
$resourceGroup = "" | |
$storageAccount = "" | |
$container = "" | |
$context = (Get-AzStorageAccount -ResourceGroupName $resourceGroup -AccountName $storageAccount).Context | |
$blob = (Get-AzStorageBlob -Context $context -Container $container -Blob $blobName) | |
$leaseStatus = $blob.ICloudBlob.Properties.LeaseStatus; | |
switch ($leaseStatus) | |
{ | |
"Locked" |
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
function Get-AzVMStatus | |
{ | |
param( | |
[Parameter(Mandatory=$true)][string]$resourceGroup, | |
[Parameter(Mandatory=$true)][string]$vmName, | |
) | |
return (Get-AzVM -ResourceGroupName $resourceGroup -Name $vmName -Status).Statuses[1].DisplayStatus | |
} |
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
$registry = "myRegistry" | |
$keep = 5 | |
$prAgo = "7d" | |
$masterAgo = "90d" | |
$prCron = "0 0 * * *" | |
$masterCron = "0 0 * * *" | |
$repositories = @("foo.bar", | |
"bar.foo", | |
"foobar.boofoo", | |
"barfoo.foobar" |
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
switch ((Get-WmiObject -class Win32_OperatingSystem).Caption) | |
{ | |
{$_.Contains("Home")} { Write-Output "Home" } | |
{$_.Contains("Business")} { Write-Output "Business" } | |
{$_.Contains("Enterprise")} { Write-Output "Enterprise" } | |
Default { "Unknown" } | |
} |
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
#!/usr/bin/env bash | |
cd /config | |
git status | |
git add . | |
dt=$(date '+%d/%m/%Y %H:%M:%S'); | |
git commit -m "$dt" | |
git push origin master |
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
$length = 10 | |
Write-Output (-Join ((65..90) + (97..122) | Get-Random -Count $length | % {[char]$_})) |
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
#!/usr/bin/env bash | |
# I think I'm funny. | |
git checkout master | |
git branch -m cableselect | |
git push origin -u cableselect | |
git push origin --delete master |
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
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; | |
exit | |
} | |
Write-Output "Disabling Windows Defender" | |
Set-MpPreference -DisableRealtimeMonitoring $true | |
Write-Output "Uninstalling Windows Defender" | |
Uninstall-WindowsFeature -Name Windows-Defender | |
Write-Output "Preventing future installation of Windows Defender" |
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
<# | |
.SYNOPSIS | |
Create Azure Action Group with Email Alerts | |
.DESCRIPTION | |
Running this script allows you to create an Azure Action Group with an Email Address | |
This PowerShell script is released under the MIT license http://www.opensource.org/licenses/MIT | |
.PARAMETER $emailaddress the email address to send the notifications to | |
.PARAMETER $actionGroupName the name of the action group | |
.PARAMETER $rgName the name of the resource group to create the action group in |
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
$subscriptionId = "" | |
$rg = "" | |
$storageAccount = "" | |
$days = 365 | |
Add-AzLogProfile -Location 'Global' -Name ExportLogProfile -RetentionInDays $days -StorageAccountId /subscriptions/$subscriptionId/resourceGroups/$rg/providers/Microsoft.Storage/storageAccounts/$storageAccount |