Skip to content

Instantly share code, notes, and snippets.

View PrateekKumarSingh's full-sized avatar

Prateek Singh PrateekKumarSingh

View GitHub Profile
# Parameter Definition
Param
(
[Parameter(mandatory = $true)] [String] $DPMServer,
[String] $SendEmailTo,
[String] $OutputDirectory,
[String] $SMTPServer
)
# HTML Body Definition Start
Function Resolve-Host()
{
Param(
[Parameter(Mandatory=$true,Position=0)] $HostEntry,
[Switch] $HostnameToIP,
[Switch] $FlushDNS
)
If($FlushDNS)
{
Function Get-Distance()
{
Param(
[Parameter(Mandatory=$true,Position=0)] $Origin,
[Parameter(Mandatory=$true,Position=1)] $Destination,
[Parameter(Mandatory=$true,Position=2)] [ValidateSet('driving','bicycling','walking')] $Mode,
[Switch] $InMiles
)
$Units='metric' # Default set to Kilometers
Param(
[Parameter(Mandatory=$true,Position=0)] $ImportModuleFrom,
[Parameter(Position=1)] $LogPath
)
Function Create-Form
{
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
# Create the Conatainer Form to place the Labels and Textboxes
Function Get-Direction()
{
Param(
[Parameter(Mandatory=$true,Position=0)] $Origin,
[Parameter(Mandatory=$true,Position=1)] $Destination,
[Parameter(Position=2)] [ValidateSet('driving','bicycling','walking')] $Mode ="driving",
[Switch] $InMiles
)
@PrateekKumarSingh
PrateekKumarSingh / Get-Synonym.ps1
Last active April 13, 2018 11:28
Updated on 26-May-16 10:29:38 by Prateek Singh
Function Get-Synonym
{
Param(
[Parameter(Mandatory=$true)]
[ValidateScript({
If($_ -match "^[a-zA-Z]+$"){
$True
}
#Test-PortConnectivity -Source '127.0.0.1' -RemoteDestination 'dc1' -Port 57766
#Test-PortConnectivity '127.0.0.1' 'dc1' 57766 -Protocol UDP -Iterate
#Test-PortConnectivity 'localhost' 'dc2' 51753 -Protocol UDP
#Test-PortConnectivity -Source $EUCAS -RemoteDestination $EUMBX -Port 135 -Iterate
#Test-PortConnectivity -Source 'localhost' -RemoteDestination '127.0.0.1' -Port 135 -Iterate -protocol TCP
Function Test-PortConnectivity()
{
Param
Function Auto-Complete()
{
Return (Invoke-RestMethod -Uri "http://api.bing.com/qsml.aspx?query=$($TextBox1.text)").searchsuggestion.section.item.text
}
Function Create-WinForm()
{
#Calling the Assemblies
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
#Function to fetch the data from Wolfram|Alpha API based on user query
Function Invoke-WolframAlphaAPI($Query)
{
Return (Invoke-RestMethod -Uri "http://api.wolframalpha.com/v2/query?appid=APIKEY&input=$($Query.Replace(' ','%20'))").queryresult
}
#Eventhandler and Flow control once the Search button is pressed
$EventHandler =[System.EventHandler]{
$Panel2.Visible = $False
Function Get-Emotion()
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string] $ImagePath
)
$Splat = @{