Skip to content

Instantly share code, notes, and snippets.

View martin77s's full-sized avatar

Martin Schvartzman martin77s

View GitHub Profile
@martin77s
martin77s / Get-InstalledSoftware.ps1
Created May 26, 2018 19:31
Get installed software from the local or remote machine by remotely querying the registry (NOT using Win32_Product)
function Get-InstalledSoftware {
[cmdletbinding()]
param(
[parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[string[]]$ComputerName = $env:ComputerName
)
begin {
$UninstallRegKey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall'
}
@martin77s
martin77s / Remove-AzureRMHybridConnection.ps1
Last active August 28, 2018 19:02
Select and remove Azure Hybrid Connection objects from all namespaces in all resource groups
# Login to Azure
Login-AzureRmAccount
# Select a specific subscription for the context
Get-AzureRmSubscription | Out-GridView -PassThru -Title 'Select Subscription' | Select-AzureRmSubscription
# Get all the Hybrid Connections from all namespaces in all resource groups
$hybridConnections = Get-AzureRmResource -ResourceType Microsoft.Relay/namespaces | ForEach-Object {
$resourceGroupName = $_.ResourceGroupName
Get-AzureRmRelayHybridConnection -ResourceGroupName $resourceGroupName -Namespace $namespace.Name | ForEach-Object {
@martin77s
martin77s / Add-ExtendedAttribute.ps1
Created September 14, 2018 14:37
Add-ExtendedAttribute
function Add-ExtendedAttribute {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
[Alias(‘FullName’, ‘PSPath’)]
[string[]]$Path,
@martin77s
martin77s / Get-AzVmSizesByLocation.ps1
Last active April 8, 2019 11:32
Get the VM sizes available by location (region)
function Get-AzVmSizesByLocation {
[CmdletBinding()]
param($LocationFilter = '*')
Write-Verbose -Message 'Getting all locations with the vmSizes providers'
$locations = Get-AzResourceProvider |
Where-Object { $_.ResourceTypes.ResourceTypeName -contains 'locations/vmSizes' } |
Select-Object -ExpandProperty Locations
@martin77s
martin77s / Send-RemoteToastNotification.ps1
Created June 15, 2019 18:52
Send toast notification to a remote computer
PARAM(
$RemoteComputer = $env:COMPUTERNAME,
$Sender,
$Message = (Get-Date),
$ImageFile
)
function New-ToastNotification {
param($Sender, $Message, $ImageBase64)