full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/philippetremblay_AzureRM-scipts/ForcedTunnelingScriptRM_incl_excludions.ps1
ForcedTunnelingScriptRM_incl_excludions.ps1
######################################################################## # Rudimentary created to automate the configuration of forced Tunneling in Azure # Script is as-is, feel free to modify and improve ######################################################################## # Connect to an Azure subscript...
PowerShellCorpus/Github/DennisDyallo_unified_remote_custom_remotes/run.ps1
run.ps1
param($w_minutes, $f_minutes, $turnLightsOffAfterWait) Write-Host "w_minutes: $w_minutes" Write-Host "f_minutes: $f_minutes" Write-Host "turnLightsOffAfterWait: $turnLightsOffAfterWait" Add-Type -TypeDefinition @' using System.Runtime.InteropServices; [Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType...
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/packages/jQuery.1.10.2/Tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # Determine the file paths $projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName $origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName if (Test-Path $projectIntelliSense...
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/packages/jQuery.1.10.2/Tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # VS 11 and above supports the new intellisense JS files $vsVersion = [System.Version]::Parse($dte.Version) $supportsJsIntelliSenseFile = $vsVersion.Major -ge 11 if (-not $supportsJsIntelliSenseFile) { $displayVersio...
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/packages/jQuery.1.10.2/Tools/common.ps1
common.ps1
function Get-Checksum($file) { $cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider" $fileInfo = Get-Item $file trap { ; continue } $stream = $fileInfo.OpenRead() if ($? -eq $false) { # Couldn't open file for reading return $null } $bytes = $...
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/packages/Modernizr.2.6.2/Tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # Update the _references.js file Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/packages/Modernizr.2.6.2/Tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) if ($scriptsFolderProjectItem -eq $null) { # No Scripts folder Write-Host "No Scripts folder found" exit } # Update the _references.js file AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileName...
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/packages/Modernizr.2.6.2/Tools/common.ps1
common.ps1
function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) { try { $referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js") } catch { # _references.js file not found return } if ($referencesFileProject...
PowerShellCorpus/Github/jzcolas_play-n-go-work-test/GameStore/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/jzcolas_play-n-go-work-test/GameStore/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/vivienchevallier_Article-AzureAppService.WebsiteSslBindingArmTemplate/AzureAppService.WebsiteSslBindingArmTemplate/Deploy-AzureResourceGroup.ps1
Deploy-AzureResourceGroup.ps1
#Requires -Version 3.0 #Requires -Module AzureRM.Resources #Requires -Module Azure.Storage Param( [string] [Parameter(Mandatory=$true)] $ResourceGroupLocation, [string] $ResourceGroupName = 'AzureAppService.WebsiteSslBindingArmTemplate', [switch] $UploadArtifacts, [string] $StorageAccountName, ...
PowerShellCorpus/Github/rvazarkar_MiscScripts/RunAsExplorerReg.ps1
RunAsExplorerReg.ps1
function Invoke-ExplorerNetonly { <# .SYNOPSIS Enables explorer.exe to be used through runas /netonly by setting a particular registry key. .PARAMETER Restore Restore the registry key to its original value. #> [CmdletBinding()] param( [switch] $Restore ...
PowerShellCorpus/Github/rvazarkar_MiscScripts/GenerateUsersGroups.ps1
GenerateUsersGroups.ps1
Import-Module ActiveDirectory $total = 300000 for ($userIndex=0; $userIndex -lt $total; $userIndex++) { $userID = "{0:000000}" -f ($userIndex + 1) $userName = "test.user$userID" $groupName = "test.group$userID" $var = Get-Random -minimum 1 -maximum $userIndex $second = "{0:000000}" -f $var...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/module.psdeploy.ps1
module.psdeploy.ps1
if($ENV:BHProjectName -and $ENV:BHProjectName.Count -eq 1) { Deploy Module { By PSGalleryModule { FromSource $ENV:BHProjectName To PSGallery WithOptions @{ ApiKey = $ENV:PSGalleryApiKey } } } }
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/psake.ps1
psake.ps1
properties { $projectRoot = $ENV:BHProjectPath if(-not $projectRoot) { $projectRoot = $PSScriptRoot } $sut = "$projectRoot\POSHOrigin_vSphere" $tests = "$projectRoot\Tests" $psVersion = $PSVersionTable.PSVersion.Major } task default -depends Deploy task Init { "`nS...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/build.ps1
build.ps1
[cmdletbinding()] param( [string[]]$Task = 'default' ) function Resolve-Module { [Cmdletbinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] [string[]]$Name ) Process { foreach ($ModuleName in $Name) { $Module = Get-Module -Name $ModuleName...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/Invoke.ps1
Invoke.ps1
#<# # This script expects to be passed a psobject with all the needed properties # in order to invoke a 'VirtualMachine' DSC resource. ##> #param( # $Options, # [bool]$Direct = $true #) #$type = $Options.Resource.split(':')[1] #switch ($type) { # 'vm' { # $provJson = '' # if...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Invoke.ps1
Invoke.ps1
<# This script expects to be passed a psobject with all the needed properties in order to invoke a 'VirtualMachine' DSC resource. #> [cmdletbinding()] param( [parameter(mandatory)] [psobject]$Options, [bool]$Direct = $false ) # Ensure we have a valid 'ensure' property if ($null -eq $O...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Powershell/Test.ps1
Test.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'Powershell script provisioner test: beginning' } process { $scriptPath = $Options.ProvOptions.Path if (($scriptPath.StartsWith('http://')) -or ($scriptPath.StartsWith('https://'))) { ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Powershell/Deprovision.ps1
Deprovision.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'Powershell script deprovisioner: beginning' } process { $scriptPath = $Options.ProvOptions.Path if (($scriptPath.StartsWith('http://')) -or ($scriptPath.StartsWith('https://'))) { $f...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Powershell/Provision.ps1
Provision.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'Powershell script provisioner: beginning' } process { $scriptPath = $Options.ProvOptions.Path if (($scriptPath.StartsWith('http://')) -or ($scriptPath.StartsWith('https://'))) { $fil...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/DomainJoin/Test.ps1
Test.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'DomainJoin provisioner test: beginning' } process { #Write-Verbose -Message 'Testing DomainJoin provisioner...' $provOptions = ConvertFrom-Json -InputObject $Options.Provisioners $djOptions ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/DomainJoin/Deprovision.ps1
Deprovision.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'DomainJoin deprovisioner: beginning' } process { Write-Verbose -Message 'Running DomainJoin deprovisioner...' $provOptions = ConvertFrom-Json -InputObject $Options.Provisioners $djOptions = $p...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/DomainJoin/Provision.ps1
Provision.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'DomainJoin provisioner: beginning' } process { Write-Verbose -Message 'Running DomainJoin provisioner...' $provOptions = ConvertFrom-Json -InputObject $Options.Provisioners $djOptions = $provO...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/Test.ps1
Test.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'Chef provisioner test: beginning' } process { # Test to see if the Chef client is already installed $provOptions = ConvertFrom-Json -InputObject $Options.Provisioners $chefOptions = ($provOp...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/Deprovision.ps1
Deprovision.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'Chef deprovisioner: beginning' } process { try { Write-Verbose -Message 'Deleting node from Chef...' $provOptions = ConvertFrom-Json -InputObject $Options.Provisioners $chefOp...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/Provision.ps1
Provision.ps1
[cmdletbinding()] param( [parameter(mandatory)] $Options ) begin { Write-Debug -Message 'Chef provisioner: beginning' } process { try { Write-Verbose -Message 'Configuring Chef client...' $provOptions = ConvertFrom-Json -InputObject $Options.Provisioners $chefOpti...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_InvokeChefQuery.ps1
_InvokeChefQuery.ps1
<# .SYNOPSIS Run the desired query against chef and pass back an object #> [CmdletBinding()] param ( [parameter(Mandatory)] [string]$OrgUri, [alias("path")] # Path that is being requested from the chef server $uri, [ValidateSet('GET', 'PUT', 'POST', 'DELETE')] [string] #...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_InvokeChefRestMethod.ps1
_InvokeChefRestMethod.ps1
[CmdletBinding()] param ( [string] # The URI of the end point that needs to used $uri, [hashtable] # Hash of headers that need to be added to the request $headers = @{}, [string] # The accept string. $accept = "application/json", [ValidateSet('GET', 'PUT', 'POST'...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_InitializeBouncyCastle.ps1
_InitializeBouncyCastle.ps1
# Load the Bouncycastle library without locking the DLL or needlessly re-loading try { $assemblyLoaded = New-Object Org.BouncyCastle.Crypto.Engines.RsaEngine -ErrorAction SilentlyContinue } catch { $dll = Join-Path -Path $PSScriptRoot -ChildPath 'BouncyCastle.Crypto.dll' if ( !(Test-Path $dll) ) { ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_SetHeaders.ps1
_SetHeaders.ps1
<# .SYNOPSIS Build up the headers that are required for a chef API query .DESCRIPTION Function to build up the headers for the query against the chef server. It will also build up the hash that is required for the body and then sign it #> param ( [string] $path, [string] $method = "GET"...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_GetBase64.ps1
_GetBase64.ps1
param ( $data ) # if the $data is a string then ensure it is a byte array if ($data.GetType().Name -eq "String") { $data = [System.Text.Encoding]::UTF8.GetBytes($data) } # Return the base64 representation of the string [System.Convert]::ToBase64String($data)
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_GetKeyPairFromPem.ps1
_GetKeyPairFromPem.ps1
<# .SYNOPSIS Creates a key object based on PEM data passed to the function .DESCRIPTION BouncyCastle encryption does not read in a PEM file directly, it has to be imported so that it is converted to an object. This function checks to see if the PEM that has been passed is actually a stri...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_InvokeEncrypt.ps1
_InvokeEncrypt.ps1
[CmdletBinding()] param ( # String to encrypt $data, [alias('pemPath')] # the item in the config to use to sign the data $pem, [switch] # The default way to encrypt with RSA is to use the public key # By setting this switch the private key will be used instead $private ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Provisioners/Chef/helpers/_GetChecksum.ps1
_GetChecksum.ps1
<# .SYNOPSIS Return the checksum of the specified file #> param ( [Parameter(ParameterSetName="file")] [string] # Path to the file to get the checksum for $path, [Parameter(ParameterSetName="string")] [string] # The string to get the checksum for $string, [Va...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_GetConfigDiskToVMDiskMapping.ps1
_GetConfigDiskToVMDiskMapping.ps1
function _GeConfigDiskToVMDiskMapping { [cmdletbinding()] param ( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$DiskSpec ) try { $vmView = $vm | Get-View -Verbose:$false -D...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetTags.ps1
_SetTags.ps1
function _SetTags { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNull()] [string]$Tags ) $desiredTags = $Tags | ConvertFrom-Json $tagAssignments = $vm | Get-TagAssignment...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestGuestDisks.ps1
_TestGuestDisks.ps1
function _TestGuestDisks { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$DiskSpec, [Parameter(Mandatory)] [pscredential]$Credential ) be...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_RequestInfoBloxIP.ps1
_RequestInfoBloxIP.ps1
function _RequestInfoBloxIP { [cmdletbinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Network, [Parameter(Mandatory)] [ValidateNotNullOrEmpt...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_GetGuestVMIPAddress.ps1
_GetGuestVMIPAddress.ps1
function _GetGuestVMIPAddress{ [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $VM ) # Get the VM again to ensure we have the latest information about it # because the IP address will only get populated once VMware Tools is running $t = Get-...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetVMPowerState.ps1
_SetVMPowerState.ps1
function _SetVMPowerState { [cmdletbinding()] param ( [Parameter(Mandatory)] [ValidateNotNull()] $vm ) if ($vm.PowerState -eq 'PoweredOn') { return $true } else { try { Write-Verbose -Message 'Powering on VM' Start-VM -VM ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_UpdateTools.ps1
_UpdateTools.ps1
function _UpdateTools { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $VM ) # VM must be powered on to upgrade tools if ($VM.PowerState -eq 'PoweredOn') { Write-Verbose -Message 'Updating tools with [NoReboot]' $VM | Updat...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_WaitForVMTools.ps1
_WaitForVMTools.ps1
function _WaitForVMTools { param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [pscredential]$Credential ) $toolsTimeout = 20 $ipTimeout = 20 # Wait until VM tools is available and we have an IP $result = Wait-Too...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMDisks.ps1
_TestVMDisks.ps1
function _TestVMDisks { [cmdletbinding()] param ( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$DiskSpec ) begin { Write-Debug -Message '_TestVMDisks() starting' $...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_DisconnectFromvCenter.ps1
_DisconnectFromvCenter.ps1
function _DisconnectFromvCenter { [cmdletbinding()] param( [parameter(Mandatory)] [string]$vCenter ) try { Write-Debug -Message "Disconnecting from vCenter [$vCenter]" Disconnect-VIServer -Server $vCenter -Force -Verbose:$false Write-Debug -Message "Dis...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_GetVMFolderPath.ps1
_GetVMFolderPath.ps1
function _GetVMFolderPath { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $VM ) $parent = $VM.Folder $path = $VM.Folder.Name While ($parent.ExtensionData.MoRef.Type -eq 'Folder') { $parent = $parent.Parent if ($parent.Nam...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetVMRAM.ps1
_SetVMRAM.ps1
function _SetVMRAM { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNull()] [int]$RAM ) if ($vm.MemoryGB -ne $RAM) { $continue = $false # If VM is powered on, ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_GetVMFolderByPath.ps1
_GetVMFolderByPath.ps1
# Taken with love from http://www.lucd.info/2012/05/18/folder-by-path/ # with a few minor modifications function _GetVMFolderByPath{ <# .SYNOPSIS Retrieve folders by giving a path .DESCRIPTION The function will retrieve a folder by it's path. The path can contain any type of leave (folder o...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_refreshHostStorageCache.ps1
_refreshHostStorageCache.ps1
function _RefreshHostStorageCache { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [pscredential]$Credential ) try { $ip = _GetGuestVMIPAddress -VM $vm $os = _GetGuestOS -VM $vm -Crede...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_GetGuestOS.ps1
_GetGuestOS.ps1
function _GetGuestOS{ [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [pscredential]$Credential ) #Get guest operating system version try { $ip = _GetGuestVMIPAddress -VM $vm Wri...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMNICs.ps1
_TestVMNICs.ps1
function _TestVMNICs { }
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetGuestDisks.ps1
_SetGuestDisks.ps1
function _SetGuestDisks{ [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$DiskSpec, [Parameter(Mandatory)] [pscredential]$Credential ) begi...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_FormatOldGuestDisk.ps1
_FormatOldGuestDisk.ps1
function _FormatOldGuestDisk { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $disk, [Parameter(Mandatory)] [ValidateNotNull()] $session, [ValidateSet('GPT', 'MBR')] [string]$PartitionStyle = 'GPT', [Pa...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMTools.ps1
_TestVMTools.ps1
function _TestVMTools { [cmdletbinding()] param( $VM ) # Possible values indicating tools need to be installed/updated $old = @('guestToolsNeedUpgrade', 'guestToolsNotInstalled') if ($VM.ExtensionData.Guest.ToolsVersionStatus -notin $old) { return $true }...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetVMNICs.ps1
_SetVMNICs.ps1
function _SetVMNICs { param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$NICSpec, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$CustomizationSpec, ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetVMDiskSCSIController.ps1
_SetVMDiskSCSIController.ps1
function _SetVMDiskSCSIController { [cmdletbinding()] param( [parameter(Mandatory)] $VM, [parameter(Mandatory)] $Disk, [ValidateRange(0, 3)] [parameter(Mandatory)] [int]$ControllerId, # Missing BusNumber 7 on purpose [Val...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMRAM.ps1
_TestVMRAM.ps1
function _TestVMRAM { [cmdletbinding()] param( $VM, [int]$RAM ) # VM matches memory if ($VM.MemoryGB -ne $RAM) { return $false } else { return $true } }
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_testTags.ps1
_testTags.ps1
function _TestTags { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNull()] [string]$Tags ) $result = $true # Get tag information from vCenter $desiredTags = $Tags | Con...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_RenameCDROM.ps1
_RenameCDROM.ps1
function _RenameCDROM { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $cim, [string]$DriveLetter = 'Z' ) $DriveLetter = "$DriveLetter`:" # If the VM has a cdrom, mount it as 'Z:' if (((Get-CimInstance -CimSession $cim -ClassNa...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetVMDisks.ps1
_SetVMDisks.ps1
function _SetVMDisks { [cmdletbinding()] param ( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$DiskSpec ) $configDisks = ConvertFrom-Json -InputObject $DiskSpec -Verbose:$false ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_ConnectTovCenter.ps1
_ConnectTovCenter.ps1
function _ConnectTovCenter { [cmdletbinding()] param( [string]$vCenter, [pscredential]$Credential ) if ($null -ne (Get-Module -Name VMware.VimAutomation* -ListAvailable -ErrorAction SilentlyContinue -Verbose:$false)) { Import-Module VMware.VimAutomation.Core -Verbose:$fa...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMCPU.ps1
_TestVMCPU.ps1
function _TestVMCPU { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNull()] [int]$TotalvCPU, [Parameter(Mandatory)] [ValidateNotNull()] [int]$CoresPerSocket )...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_WaitForGuestCustomization.ps1
_WaitForGuestCustomization.ps1
function _WaitForGuestCustomization { param( [Parameter(Mandatory)] [ValidateNotNull()] $vm ) $timeout = 15 # Wait until VM has started Write-Verbose -Message 'Waiting for VM to start...' $sw = [diagnostics.stopwatch]::StartNew() while ($sw.elapsed.minu...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestChefClient.ps1
_TestChefClient.ps1
function _TestGuestDisks { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [pscredential]$Credential ) begin { Write-Debug -Message '_TestChefClient() starting' } process { ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_SetVMCPU.ps1
_SetVMCPU.ps1
function _SetVMCPU { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [ValidateNotNull()] [int]$TotalvCPU, [Parameter(Mandatory)] [ValidateNotNull()] [int]$CoresPerSocket ) ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMFolder.ps1
_TestVMFolder.ps1
function _TestVMFolder { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [string]$VMFolder ) $path = _GetVMFolderPath -VM $VM # Normalize slashes and strip out any leading or training '/' # ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_MoveVM.ps1
_MoveVM.ps1
function _MoveVM { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [string]$VMFolder ) $folder = _GetVMFolderByPath -Path $VMFolder -ErrorAction SilentlyContinue if ($folder) { Write-Verbos...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_FormatGuestDisk.ps1
_FormatGuestDisk.ps1
function _FormatGuestDisk { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNull()] $disk, [Parameter(Mandatory)] [ValidateNotNull()] $session, [ValidateSet('GPT', 'MBR')] [string]$PartitionStyle = 'GPT', [Param...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_CreateVM.ps1
_CreateVM.ps1
function _CreateVM { [cmdletbinding(DefaultParameterSetName='cluster')] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$VMTemplate, [Parameter(Mandatory, Param...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMPowerState.ps1
_TestVMPowerState.ps1
function _TestVMPowerState { param( [Parameter(Mandatory)] [ValidateNotNull()] $vm, [Parameter(Mandatory)] [bool]$PowerOnAfterCreation ) switch ($PowerOnAfterCreation) { $true { return ($PowerOnAfterCreation -and ($vm.PowerState -eq '...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_TestVMDiskCount.ps1
_TestVMDiskCount.ps1
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_GetGuestDiskToVMDiskMapping.ps1
_GetGuestDiskToVMDiskMapping.ps1
# Based on https://communities.vmware.com/thread/528535?start=0&tstart=0 function _GetGuestDiskToVMDiskMapping { [cmdletbinding()] param ( [Parameter(Mandatory)] [ValidateNotNull()] $VM, [Parameter(Mandatory)] $cim, [Parameter(Mandatory)] [...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/Examples/Example_VM.ps1
Example_VM.ps1
$DscConfigData = @{ AllNodes = @( @{ NodeName = "*" PSDscAllowPlainTextPassword = $true PSDscAllowDomainUser = $true } @{ NodeName = 'localhost' } ) } Configuration Example_VM { param( [string[]]$NodeName...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/Examples/Example_POSHOrigin_VM.ps1
Example_POSHOrigin_VM.ps1
resource 'vsphere:vm' 'VM01' @{ ensure = 'present' description = 'Test VM' vCenter = 'vcenter01.local' datacenter = 'datacenter01' cluster = 'cluster01' vmTemplate = 'W2K12_R2_Std' customizationSpec = 'W2K12_R2' powerOnAfterCreation = $true totalvCPU = 2 coresPerSocket ...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/POSHOrigin_vSphere/Examples/Example_POSHOrigin_with_defaults.ps1
Example_POSHOrigin_with_defaults.ps1
resource 'vsphere:vm' 'VM01' @{ defaults = '.\defaults.psd1' description = 'Test VM 01' }
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/Tests/Manifest.Tests.ps1
Manifest.Tests.ps1
$moduleName = 'POSHOrigin_vSphere' $here = Split-Path -Parent $MyInvocation.MyCommand.Path $root = Split-Path -Path $here -Parent $modulePath = Join-Path -Path $root -ChildPath $moduleName $manifestPath = Join-Path -Path $modulePath -Child "$moduleName.psd1" $changelogPath = Join-Path -Path $root -Child "CHANGELOG...
PowerShellCorpus/Github/devblackops_POSHOrigin_vSphere/Tests/Meta.Tests.ps1
Meta.Tests.ps1
<# .summary Test that describes code. .PARAMETER Force Used to force any installations to occur without confirming with the user. #> [CmdletBinding()] Param ( [Boolean]$Force = $false ) if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { $PSScriptRoot = ...
PowerShellCorpus/Github/mhendric_xWebConfigurationProperty/Examples/TestWebConfigurationProperty.ps1
TestWebConfigurationProperty.ps1
Configuration TestWebConfigurationProperty { param ( [PSCredential]$ShellCreds, [PSCredential]$CertCreds, [PSCredential]$FileCopyCreds, [string]$NodeFilter = "*" ) Import-DscResource -Module xWebConfigurationProperty Node "localhost" { xWebCon...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/VolumeShadowCopyTools.ps1
VolumeShadowCopyTools.ps1
function Get-VolumeShadowCopy { <# .SYNOPSIS Lists the device paths of all local volume shadow copies. PowerSploit Function: Get-VolumeShadowCopy Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None Version: 2.0...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Invoke-CredentialInjection.ps1
Invoke-CredentialInjection.ps1
function Invoke-CredentialInjection { <# .SYNOPSIS This script allows an attacker to create logons with clear-text credentials without triggering a suspicious Event ID 4648 (Explicit Credential Logon). The script either creates a suspended winlogon.exe process running as SYSTEM, or uses an existi...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Invoke-NinjaCopy.ps1
Invoke-NinjaCopy.ps1
function Invoke-NinjaCopy { <# .SYNOPSIS This script can copy files off an NTFS volume by opening a read handle to the entire volume (such as c:) and parsing the NTFS structures. This requires you are an administrator of the server. This allows you to bypass the following protections: 1. Files which are ope...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Get-TimedScreenshot.ps1
Get-TimedScreenshot.ps1
function Get-TimedScreenshot { <# .SYNOPSIS Takes screenshots at a regular interval and saves them to disk. PowerSploit Function: Get-TimedScreenshot Author: Chris Campbell (@obscuresec) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION A function that tak...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Invoke-TokenManipulation.ps1
Invoke-TokenManipulation.ps1
function Invoke-TokenManipulation { <# .SYNOPSIS This script requires Administrator privileges. It can enumerate the Logon Tokens available and use them to create new processes. This allows you to use anothers users credentials over the network by creating a process with their logon token. This will work even wi...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Get-VaultCredential.ps1
Get-VaultCredential.ps1
function Get-VaultCredential { <# .SYNOPSIS Displays Windows vault credential objects including cleartext web credentials. PowerSploit Function: Get-VaultCredential Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Ge...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Invoke-Mimikatz.ps1
Invoke-Mimikatz.ps1
function Invoke-Mimikatz { <# .SYNOPSIS This script leverages Mimikatz 2.0 and Invoke-ReflectivePEInjection to reflectively load Mimikatz completely in memory. This allows you to do things such as dump credentials without ever writing the mimikatz binary to disk. The script has a ComputerName parameter which a...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Get-Keystrokes.ps1
Get-Keystrokes.ps1
function Get-Keystrokes { <# .SYNOPSIS Logs keys pressed, time and the active window. PowerSploit Function: Get-Keystrokes Author: Chris Campbell (@obscuresec) and Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None ...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Get-GPPPassword.ps1
Get-GPPPassword.ps1
function Get-GPPPassword { <# .SYNOPSIS Retrieves the plaintext password and other information for accounts pushed through Group Policy Preferences. PowerSploit Function: Get-GPPPassword Author: Chris Campbell (@obscuresec) License: BSD 3-Clause Required Dependencies: None Optional D...
PowerShellCorpus/Github/PYANTSU_test/Exfiltration/Out-Minidump.ps1
Out-Minidump.ps1
function Out-Minidump { <# .SYNOPSIS Generates a full-memory minidump of a process. PowerSploit Function: Out-Minidump Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Out-Minidump writes a...
PowerShellCorpus/Github/PYANTSU_test/CodeExecution/Invoke-Shellcode.ps1
Invoke-Shellcode.ps1
function Invoke-Shellcode { [CmdletBinding( DefaultParameterSetName = 'RunLocal', SupportsShouldProcess = $True , ConfirmImpact = 'High')] Param ( [ValidateNotNullOrEmpty()] [UInt16] $ProcessID, [Parameter( ParameterSetName = 'RunLocal' )] [ValidateNotNullOrEmpty()] [Byte[]] ...
PowerShellCorpus/Github/PYANTSU_test/CodeExecution/Invoke-WmiCommand.ps1
Invoke-WmiCommand.ps1
#Requires -Version 2 function Invoke-WmiCommand { <# .SYNOPSIS Executes a PowerShell ScriptBlock on a target computer using WMI as a pure C2 channel. Author: Matthew Graeber License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Invoke-WmiCommand executes a Power...
PowerShellCorpus/Github/PYANTSU_test/CodeExecution/Invoke--Shellcode.ps1
Invoke--Shellcode.ps1
function Invoke-Shellcode { <# .SYNOPSIS Inject shellcode into the process ID of your choosing or within the context of the running PowerShell process. PowerSploit Function: Invoke-Shellcode Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: N...
PowerShellCorpus/Github/PYANTSU_test/CodeExecution/Invoke-ShellcodeMSIL.ps1
Invoke-ShellcodeMSIL.ps1
function Invoke-ShellcodeMSIL { <# .SYNOPSIS Execute shellcode within the context of the running PowerShell process without making any Win32 function calls. PowerSploit Function: Invoke-ShellcodeMSIL Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: N...
PowerShellCorpus/Github/PYANTSU_test/CodeExecution/Invoke-DllInjection.ps1
Invoke-DllInjection.ps1
function Invoke-DllInjection { <# .SYNOPSIS Injects a Dll into the process ID of your choosing. PowerSploit Function: Invoke-DllInjection Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Invoke-DllInjection injects a ...
PowerShellCorpus/Github/PYANTSU_test/CodeExecution/Invoke-ReflectivePEInjection.ps1
Invoke-ReflectivePEInjection.ps1
function Invoke-ReflectivePEInjection { <# .SYNOPSIS This script has two modes. It can reflectively load a DLL/EXE in to the PowerShell process, or it can reflectively load a DLL in to a remote process. These modes have different parameters and constraints, please lead the Notes section (GENERAL NOTES) for in...
PowerShellCorpus/Github/PYANTSU_test/AntivirusBypass/Find-AVSignature.ps1
Find-AVSignature.ps1
function Find-AVSignature { <# .SYNOPSIS Locate tiny AV signatures. PowerSploit Function: Find-AVSignature Authors: Chris Campbell (@obscuresec) & Matt Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Locates single Byte AV signature...
PowerShellCorpus/Github/PYANTSU_test/ScriptModification/Out-CompressedDll.ps1
Out-CompressedDll.ps1
function Out-CompressedDll { <# .SYNOPSIS Compresses, Base-64 encodes, and outputs generated code to load a managed dll in memory. PowerSploit Function: Out-CompressedDll Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION...
PowerShellCorpus/Github/PYANTSU_test/ScriptModification/Out-EncryptedScript.ps1
Out-EncryptedScript.ps1
function Out-EncryptedScript { <# .SYNOPSIS Encrypts text files/scripts. PowerSploit Function: Out-EncryptedScript Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Out-EncryptedScript will encrypt a script (or any tex...
PowerShellCorpus/Github/PYANTSU_test/ScriptModification/Remove-Comments.ps1
Remove-Comments.ps1
function Remove-Comments { <# .SYNOPSIS Strips comments and extra whitespace from a script. PowerSploit Function: Remove-Comments Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Remove-Comments strips out comments a...
PowerShellCorpus/Github/PYANTSU_test/ScriptModification/Out-EncodedCommand.ps1
Out-EncodedCommand.ps1
function Out-EncodedCommand { <# .SYNOPSIS Compresses, Base-64 encodes, and generates command-line output for a PowerShell payload script. PowerSploit Function: Out-EncodedCommand Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DE...
PowerShellCorpus/Github/PYANTSU_test/Recon/Invoke-ReverseDnsLookup.ps1
Invoke-ReverseDnsLookup.ps1
function Invoke-ReverseDnsLookup { <# .SYNOPSIS Perform a reverse DNS lookup scan on a range of IP addresses. PowerSploit Function: Invoke-ReverseDnsLookup Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Invoke-Reve...