Skip to content

Instantly share code, notes, and snippets.

View DexterPOSH's full-sized avatar
🌱
Learning && Growing

Deepak Singh Dhami DexterPOSH

🌱
Learning && Growing
View GitHub Profile
@DexterPOSH
DexterPOSH / azrdp.ps1
Last active August 29, 2015 14:18 — forked from pcgeek86/azrdp.ps1
function azrdp {
<#
.Author
Trevor Sullivan <pcgeek86@gmail.com>
.Description
Invoke a RDP session to an Azure Virtual Machine, without having to type the
Cloud Service name or Virtual Machine name.
.Outputs
@DexterPOSH
DexterPOSH / Get-ADUserWithInheritanceDisabled.ps1
Created April 14, 2015 17:13
The Function uses AD PS PSmodule to hunt for User accounts which have Inheritance disabled
<#
.Synopsis
The Function uses AD PS PSmodule to hunt for User accounts which have Inheritance disabled
.DESCRIPTION
In AD if the Users have Inheritance disabled on them then this Function will help you hunt those acounts
In addition it will also check if the Users are part of any Protected Group and report them (if any) because of
which the Inheritance is disabled. This is expected but sometimes the User might be part of a Group which is nested
member of a Protected Group, then this Function will list out all the ProtectedGroups too.
The Function needs AD PowerShell Module installed in order to run at the moment.
@DexterPOSH
DexterPOSH / ps.cmd
Created July 10, 2015 08:15
default ps.cmd which gets added to the VS Project
@echo off
cd /D %~dp0
if not exist "%DiagnosticStore%\LogFiles" mkdir "%DiagnosticStore%\LogFiles"
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -File %* >> "%DiagnosticStore%\LogFiles\%~n1.txt" 2>> "%DiagnosticStore%\LogFiles\%~n1.err.txt"
@DexterPOSH
DexterPOSH / append_configurecloudservice.ps1
Created July 10, 2015 08:20
sample gist to append to the configurecloudservice.ps1 (or you can add a new ps1) to access custom settings defined for the Cloud Service
TRY {
# search for the Dll
Write-Verbose -Message "Creating credential object"
$Splathashtable = @{
'Path' = "$env:windir\Microsoft.NET\assembly\";
'Filter' = 'Microsoft.WindowsAzure.ServiceRuntime.dll';
'Include' = '*.dll'
}
$dllfile = Get-ChildItem @Splathashtable -Recurse | Select-Object -Last 1 # selecting only one object, in case of multiple results
@DexterPOSH
DexterPOSH / New-TestVM.ps1
Last active August 29, 2015 14:27
Azure Automation runbook to deploy a Server 2016 TP3 VM on Azure.
workflow New-TestVM
{
param(
# Sepcify the Azure Subscription Name
[parameter(Mandatory)]
[String]
$AzureSubscriptionName,
# Sepcify the Azure Storage Account Name to be used to store VM VHDs.
[parameter(Mandatory)]
@DexterPOSH
DexterPOSH / Test-PortReachableUsingSourceIP.ps1
Created March 14, 2016 06:15
Test-PortReachableUsingSourceIP
Function Test-PortReachableUsingSourceIP
{
[CmdletBinding()]
[Alias()]
[OutputType([int])]
Param
(
# Specify the remote destination IPAddress.
[Parameter(Mandatory=$False,
ValueFromPipelineByPropertyName=$true,
@DexterPOSH
DexterPOSH / PSdeploy.Argumentcompleter.ps1
Created November 28, 2016 15:28
Try to create tab completion for the PSDeploy DSL.
Function PSDeployCompletion
{
param( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$CommandTree = Get-CompletionPrivateData -Key PSDeployCompletionCommandTree
if ($null -eq $CommandTree) {
$CommandTree = & {
New-CommandTree -Completion FromSource -ToolTip 'Source' -Argument
New-CommandTree -Completion To -ToolTip 'Destination' -Argument
@DexterPOSH
DexterPOSH / PSdeploy.Argumentcompleter.ps1
Created November 28, 2016 15:29
Try to create tab completion for the PSDeploy DSL.
Function PSDeployCompletion
{
param( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$CommandTree = Get-CompletionPrivateData -Key PSDeployCompletionCommandTree
if ($null -eq $CommandTree) {
$CommandTree = & {
New-CommandTree -Completion FromSource -ToolTip 'Source' -Argument
New-CommandTree -Completion To -ToolTip 'Destination' -Argument
@DexterPOSH
DexterPOSH / Blog-node-connectivity-helper.psm1
Created September 28, 2017 10:50
Function Test-NetConnectionWithSourceAddress definition.
Function Test-NetConnectionWithSourceAddress
{
[CmdletBinding()]
[Alias('PortTestWithSource')]
[OutputType([Boolean])]
Param
(
# Specify the remote destination IPAddress.
[Parameter(Mandatory=$False,
ValueFromPipelineByPropertyName=$true,
@{
AllNodes = @(
@{
# common node information hashtable
NodeName = '*'; # do not edit
SETTeamName = 'S2DSwitch'; # <Edit> name of the SET team
DomainDCs = @('testad.Test.lab') # <edit> the DC names (can be a single value)
DNSServers = @('testad.Test.lab') # <edit> the DNS names (can be a single value)
Domain = 'test.lab' # <edit> the domain name
ClusterName = 'r740-mid-s2d-cluster' # <edit> the cluster name,