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-Synonym | |
{ | |
Param | |
( | |
[Parameter(Mandatory=$true,ValueFromPipeline=$true)] | |
[String] $Word | |
) | |
$Uri = "http://www.thesaurus.com/browse/$Word" | |
$ElementTagName = 'span' |
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-Meaning | |
{ | |
Param | |
( | |
[Parameter(Mandatory=$true,ValueFromPipeline=$true)] | |
[String] $Word | |
) | |
$Uri = "http://www.dictionary.com/browse/$Word" | |
$ElementTagName = 'div' | |
$ClassName = 'def-content' |
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 Test-ADCredential | |
{ | |
$Credentials = Get-Credential -Message 'Enter your domain credentials' | |
$UserName = $Credentials.UserName | |
$Password = $Credentials.GetNetworkCredential().Password | |
Add-Type -AssemblyName System.DirectoryServices.AccountManagement | |
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain') | |
try | |
{ | |
$Status = $DS.ValidateCredentials($UserName, $Password) |
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 | |
Retrieves public ip of an AzureVM. | |
.DESCRIPTION | |
Retrieves the public ip of an AzureVM, Starts the VM if the VM is not running and connect to RDP session. | |
.PARAMETER ResourceGroupName |
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
# Create an object | |
$SQLServerObject = New-Object -TypeName psobject | |
# Basic properties | |
$SQLServerObject | Add-Member -MemberType NoteProperty -Name ServerName -Value 'SQLServer' # Server Name | |
$SQLServerObject | Add-Member -MemberType NoteProperty -Name DefaultPort -Value 1433 # Port | |
$SQLServerObject | Add-Member -MemberType NoteProperty -Name Database -Value 'master' # Database | |
$SQLServerObject | Add-Member -MemberType NoteProperty -Name ConnectionTimeOut -Value 15 # Connection Timeout | |
$SQLServerObject | Add-Member -MemberType NoteProperty -Name QueryTimeOut -Value 15 # Query Timeout | |
$SQLServerObject | Add-Member -MemberType NoteProperty -Name SQLQuery -Value '' # SQL Query |
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
#requires -Module Az | |
# Please connect to Azure using Connect-AzAccount | |
# Get the complete list of Azure service locations | |
Get-AzLocation | |
<# | |
Get-AzLocation | Where-Object -FilterScript {$_.Location -match 'india'} |
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 Empty-RecycleBin | |
{ | |
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact = 'High')] | |
param | |
( | |
[Parameter(Mandatory=$false)] | |
[switch] $Force # Without confirmation | |
) | |
if($IsWindows -eq $false) { return } # Exit the script if the OS is other than Windows |
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
# PromptForChoice Args | |
$Title = "Do you want to proceed further?" | |
$Prompt = "Enter your choice" | |
$Choices = [System.Management.Automation.Host.ChoiceDescription[]] @("&Yes", "&No", "&Cancel") | |
$Default = 1 | |
# Prompt for the choice | |
$Choice = $host.UI.PromptForChoice($Title, $Prompt, $Choices, $Default) | |
# Action based on the choice |
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
$File = 'C:\Windows\Temp\delete.csv' | |
$Content = Get-Content -Path $File | |
<# File content | |
GroupA,GroupB,GroupC,1,2 | |
GroupB,GroupC,GroupD,1,2,3,4,5 | |
GroupA,GroupC,GroupE,1 | |
GroupA,GroupB,GroupE,1,2,3,4 | |
GroupC,GroupD,GroupE,1,2,3 | |
#> |
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 Update-SystemType | |
{ | |
$Mastercsv = Import-Csv "C:\Windows\Temp\CSV1.csv" | |
$Productinfo = Import-Csv "C:\Windows\Temp\CSV2.csv" | |
foreach($record in $Mastercsv) | |
{ | |
$SysType = ($Productinfo | where {$_.Code -eq $record.code}).type | |
if ([string]::IsNullOrEmpty($SysType)) | |
{ | |
$sysType = 'Unknown, due to non-matching code' |
OlderNewer