This file contains hidden or 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 Change-BackgroundColor | |
{ | |
[CmdletBinding()] | |
Param( | |
[Parameter(Position=0,ValueFromPipeline=$True)] | |
[String] $Color | |
) | |
PRocess{ |
This file contains hidden or 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-LastBootTime($servers) | |
{ | |
$creds = Get-Credential 'domain\username' | |
$lastbootuptime=@() | |
foreach($s in $servers) | |
{ | |
$Wmio=Get-WmiObject win32_operatingsystem -ComputerName $S -Credential $creds |
This file contains hidden or 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 Resolve-Hostname($IPAddress) | |
{ | |
return (ping -a $IPAddress -n 1)[1].Split(' ')[1] | |
} | |
gc C:\list.txt| %{"$(Resolve-Host $_) `t$_"} | |
This file contains hidden or 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 Start-RandomMusic($directory) | |
{ | |
Start-Process (gci $directory -Filter *.mp3 |Get-Random -Count 1).fullname -verb 'play' | |
} | |
Start-RandomMusic C:\Users\Prateek\downloads\ |
This file contains hidden or 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 Start-Recursion($Times, $Upto) | |
{ | |
If($Times -gt $Upto){$Times;Start-Recursion($Times-1)}else{break} | |
} | |
Start-Recursion 100 0 |
This file contains hidden or 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
$url="https://geekeefy.wordpress.com/2016/03/12/powershell-extract-text-from-image-and-convert-print-in-any-language/" | |
(Invoke-WebRequest -Uri $url).images.src | ?{$_ -like "*Geekeefy.files*"} -PipelineVariable pv ` | |
| %{$fn = ($pv.split("/")[-1]).split('?')[0];iwr $pv -OutFile "D:\scraping\$fn"} |
This file contains hidden or 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
# Running MSI installation | |
$MSIFile = @('C:\users\prateesi\download\zoomit.msi') | |
$MSIEXECPath = "$env:SystemRoot\system32\msiexec.exe" | |
(Start-Process $MSIEXECPath -ArgumentList "/i `"$MSIFile`" /qn" -Wait -PassThru).exitcode | |
# Running WUSA/ .EXE installation | |
$path = "C:\Users\prateesi\Downloads\Win7AndW2K8R2-KB3134760-x64.msu" | |
$ExitCode = (Start-Process 'wusa.exe' -ArgumentList "`"$path`" /quiet" -wait -PassThru).exitcode | |
Function Get-ExitCodeInformation($ExitCode) |
This file contains hidden or 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 Search-PowershellScript | |
{ | |
Param( | |
[Parameter(Mandatory=$true)] [String] $Directory, | |
[Parameter(Mandatory=$true)] [String] $Keyword, | |
[String] $Extension = ".ps1", | |
[Switch] $ShowMatchResult | |
) |
This file contains hidden or 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-GithubGist | |
{ | |
Param( | |
[Parameter(Mandatory=$true)] [String] $Path, | |
[Parameter(Mandatory=$true)] [String] $GistName, | |
[Switch] $SecretGist = $False | |
) | |
if (Test-Path -Path $Path) | |
{ |
This file contains hidden or 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-GithubGist | |
{ | |
Param( | |
[Parameter(Mandatory=$True, ValueFromPipelineByPropertyName = $True)] [String[]] $GithubUser, | |
[String[]] $FileName, | |
[switch] $openInISE | |
) |