full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/UsersUtility.ps1
UsersUtility.ps1
# =================================================================================== # Author: Marina Krynina, CSC # Func: AddUserToLocalAdministrators # Desc: Adds specified user to the Local admins group # dbInstance = SERVERNAME, e.g. DR2DBSAWS003W # username = DOMAIN\USER # ======================...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/ConfigureWindowsFeature.ps1
ConfigureWindowsFeature.ps1
# ConfigureWindowsFeature.ps1 ######################################################################### # Author: Stiven Skoklevski, CSC # Install a Windows Feature ######################################################################### . .\FilesUtility.ps1 ##################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_ExecutUnitTestServer.ps1
debug_ExecutUnitTestServer.ps1
# Script: Server side testing - Common # Author: Marina Krynina ################################################################################################# # \USER_PROFILE # \TestResults # \Logs try { $scriptPath = $env:USERPROFILE . .\LoggingV2.ps1 $true $scriptPath "Execute-Unit...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_ExecuteServerPrereqs.ps1
debug_ExecuteServerPrereqs.ps1
# Author: Marina Krynina ############################################################################################ try { write-host "INFO: Start Execute-CommonBase" # get current script location $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition . .\Execute-ServerPrer...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Update-SvnWorkingCopy.ps1
Update-SvnWorkingCopy.ps1
<# .SYNOPSIS Wrapper function for "svn.exe update" .DESCRIPTION Bring the latest changes from the repository into the working copy (HEAD revision). .PARAMETER Path The Path parameter identifies the directory of the working copy. .EXAMPLE Update-SvnWorkingCo...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_PlatformNET35BASHInstall.ps1
debug_PlatformNET35BASHInstall.ps1
tar -zxvf sxs.tar.gz -C /cygdrive/c/deploy rm -f sxs.tar.gz /cygdrive/c/windows/sysnative/DISM.exe /Online /Enable-Feature /FeatureName:NetFx3 /All /Source:c:\\deploy\\sxs\\sxs
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/PlatformUtils.ps1
PlatformUtils.ps1
. .\GlobalRepository.ps1 function get-serviceAccountPassword($username) { (get-globalvariable("ServiceAccount\$username")).value } function get-domainname { (get-globalvariable("Global\DomainFQDN")).value } function get-domainshortname { (get-globalvariable("Global\DomainNetBIOS")).value } ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Assign-ReplicateDirChanges.ps1
Assign-ReplicateDirChanges.ps1
Param( [string] $scriptPath, [string] $identity ) ################################################################################################# # Author: Marina Krynina # Desc: Assigns an account replicate directory changes permission in AD # This is required by SharePoint 2013 to support Us...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/UninstallProgram.ps1
UninstallProgram.ps1
# Mandatory heading ######################################################################### # Author: Stiven Skoklevski, CSC # Uninstall a program ######################################################################### function UninstallProgram([string] $appToUninstall) { log "INFO: Uninstall... $appT...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/FilesUtility.ps1
FilesUtility.ps1
######################################################################### # Author: Marina Krynina, CSC # Updates: # 2014-11-12 Added new functions DeployAppFiles, Extract ######################################################################### ###########################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_CreateSQLAlias.ps1
debug_CreateSQLAlias.ps1
# Author: Marina Krynina ################################################################################################# try { # get current script location $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition $scriptName = $MyInvocation.MyCommand.Name $SQLASLIAS_XML = "\Conf...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Execute-CreateSQLAlias.ps1
Execute-CreateSQLAlias.ps1
Param( [string] $scriptPath ) ################################################################################################# # Author: Marina Krynina ################################################################################################# function CheckForError { # check if error.txt exists....
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Set-VolumeLabel.ps1
Set-VolumeLabel.ps1
# Set-VolumeLabel.ps1 ######################################################################### # Author: Stiven Skoklevski, # Rename the disk label. # Eg of parameter: # $DISKLABELS = "E;Application,F;PageFile," # The above example will set Drive E label to Appplication and Drive F label to Pagefile ######...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Execute-InstallSoftwarePatches.ps1
Execute-InstallSoftwarePatches.ps1
Param( [string] $scriptPath ) # Author: Stiven Skoklevski function Execute-InstallSoftwarePatches([xml] $xmlinput) { $nodes = $xmlinput.SelectNodes("//InstallSet/Install") if (([string]::IsNullOrEmpty($nodes))) { log "INFO: No patches to install in: '$inputFile'" return 0 ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Logging.ps1
Logging.ps1
######################################################################### # Author: Marina Krynina, CSC # Updates: # 2014-11-12 Added header block # Added echo in the log function # 2015-01-22 Replaced "echo" with Write-Host as "echo" pollutes return codes ######################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_ExtractAppFiles.ps1
debug_ExtractAppFiles.ps1
# MWS2R2 - Extract App Files ############################################################### # Author: Marina Krynina # Desc: Extracts application files (ISO, ZIP) ############################################################################################ # Mandatory heading # Load Common functions . .\Globa...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Execute-InstallSoftwarePreRequisites.ps1
Execute-InstallSoftwarePreRequisites.ps1
Param( [string] $scriptPath ) # Author: Marina Krynina function Execute-InstallSoftwarePrereqs([xml] $xmlinput) { $nodes = $xmlinput.SelectNodes("//InstallSet/Install") if (([string]::IsNullOrEmpty($nodes))) { log "INFO: No prerequisites to install configured in: '$inputFile'" ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/New-RandomPassword.ps1
New-RandomPassword.ps1
function New-RandomPassword { <# .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-RandomPassw...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Install-SoftwarePatches.ps1
Install-SoftwarePatches.ps1
Param( [string] $scriptPath, [string] $installFile, [string] $arguments ) # Author: Stiven Skoklevski ############################################################################################ # Main ############################################################################################ # Load ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Set-PageFile.ps1
Set-PageFile.ps1
# Set-PageFile.ps1 ######################################################################### # Author: Stiven Skoklevski, # Remove the existing PageFile and replace with new PageFile as per parameters # Reboot is not required if moving to new drive for first time. # If updating existing PageFile configuration than...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Set-EnvironmentVariables.ps1
Set-EnvironmentVariables.ps1
# Set-EnvironmentVariables.ps1 ######################################################################### # Author: Marina Krynina, # Set environment variables. # Eg of parameter: # $ENVVARIABLES = "AppDrive~E:|LogDrive~L:|" # The above example will create AppDrive machine environment variable # with va...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_ExecuteSoftwarePrereqs.ps1
debug_ExecuteSoftwarePrereqs.ps1
# Author: Marina Krynina ############################################################################################ try { write-host "INFO: Start Execute-CommonBase" # get current script location $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition . .\Execute-InstallSof...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Get-IniContent.ps1
Get-IniContent.ps1
Function Get-IniContent { <# .Synopsis Gets the content of an INI file .Description Gets the content of an INI file and returns it as a hashtable .Notes Author : Oliver Lipkau <oliver@lipkau.net> Blog : http://oliver.lipkau....
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_GetAppFiles.ps1
debug_GetAppFiles.ps1
# MWS2 - Get App Files ############################################################## # Author: Marina Krynina # Desc: Deploys installation files onto the target server ############################################################################################ # Load Common functions . .\GlobalRepository.ps1 ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/SSLManagementUtility.ps1
SSLManagementUtility.ps1
# =================================================================================== # Author: Marina Krynina, CSC # Func: GenerateSelfSignedCertificate # Desc: Generates self-signed certificate # =================================================================================== Function GenerateSelfSignedCertif...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/Construct-URL.ps1
Construct-URL.ps1
# =================================================================================== # Author: Marina Krynina, CSC # Func: ConstructURL # Desc: if SSL ==> https://$urlbit.$suffix # if not ==> http://$urlbit.$suffix # =================================================================================== functi...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/ExecuteWindowsUsersV2.ps1
ExecuteWindowsUsersV2.ps1
################################################################################################# # Author: Stiven Skoklevski/Denis Gittard # Desc: Functions to support preparation of Windows Users ################################################################################################# . .\FilesUtility.ps1...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/debug_Assign-ReplicateDirChanges.ps1
debug_Assign-ReplicateDirChanges.ps1
# MWS2R2 -Assign Replicate Dir Changes ################################################################## # Author: Marina Krynina ################################################################################################# try { write-host "INFO: Attempting to assign Replicate Directory Changes permission t...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/ConfigFiles/admin-GetFeatures.ps1
admin-GetFeatures.ps1
# The commands below retun 3 columns. # The column used to populate the WindowsFeatures.xml file is 'Name' # Get a list of all available features Get-WindowsFeature # Get a list of features that are already installed Get-WindowsFeature | Where Installed # Get a list of features that start with the letters A...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/HTMLGenerator.ps1
HTMLGenerator.ps1
############################################################################################ # Author: Marina Krynina # Desc: Set functions to support creating of a HTML file. # Currently used in Unit Testing Framework # Updates: # - Stiven Skoklevski: load dll for non-web servers ##############################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/Execute-UnitTest-Server.ps1
Execute-UnitTest-Server.ps1
Param( [string] $scriptPath ) ############################################################################################ # Author: Marina Krynina # Desc: Executes Unit testing Server Side - Common ############################################################################################ # \USER_PROFILE # ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/UnitTest-Server-Common-IIS.ps1
UnitTest-Server-Common-IIS.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Common IIS ###########################################################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/UnitTest-Common-Utilities.ps1
UnitTest-Common-Utilities.ps1
############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Common # Updates: # Added windows features - Stiven # Added Check-WebPage - Stiven #############################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/UnitTest-Server-Template.ps1
UnitTest-Server-Template.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Template and Sample #################################################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/UnitTest-Server-Common.ps1
UnitTest-Server-Common.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Common # Updates: # Added windows features - Stiven ######################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/Debug/UnitTest-Server-Common - ORIG.ps1
UnitTest-Server-Common - ORIG.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Common ############################################################################################ ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/Debug/Execute-UnitTest-Server.ps1
Execute-UnitTest-Server.ps1
Param( [string] $scriptPath ) ############################################################################################ # Author: Marina Krynina # Desc: Executes Unit testing Server Side - Common ############################################################################################ # \USER_PROFILE # ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/Debug/debug_ExecutUnitTestServer.ps1
debug_ExecutUnitTestServer.ps1
# Script: Server side testing - Common # Author: Marina Krynina ################################################################################################# # \USER_PROFILE # \TestResults # \Logs try { $scriptPath = "c:\users\mkrynina" . .\LoggingV2.ps1 $true $scriptPath "Execute-U...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/Debug/UnitTest-Server-Common - SS.ps1
UnitTest-Server-Common - SS.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Common ############################################################################################ ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/Common/TestFramework/Debug/UnitTest-Server-Common.BK.ps1
UnitTest-Server-Common.BK.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Common ############################################################################################ ...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/debug_InstallWAC2013Update.ps1
debug_InstallWAC2013Update.ps1
# MWS2R3 - Install a Office Web Apps update ############################################################### # Author: Marina Krynina # Desc: installs an update ############################################################################################ # \USER_PROFILE # \Install # \Config # \Insta...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/debug_InstallOWA2013.ps1
debug_InstallOWA2013.ps1
# Script: InstallOWA2013 # Author: Marina Krynina, CSC ################################################################################################# # \USER_PROFILE # \Install # \Config # \InstallMedia # \Logs try { Write-host "INFO: Starting script execution" # $scriptPath...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/debug_ConfigureOWA2013.ps1
debug_ConfigureOWA2013.ps1
# MWS2R2 - OWA 2013 Configure ################################################################## # Author: Marina Krynina ################################################################################################# # \USER_PROFILE # \Install # \Config # \InstallMedia # \OWA2013S...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/debug_RemoveWAC2013Server.ps1
debug_RemoveWAC2013Server.ps1
######################################################### # Script: debug_RemoveWAC2013Server #################### # Author: Kulothunkan Palasundram # Desc: Removes a server from the Office Web Apps Farm ######################################################### # \USER_PROFILE # \Install # \Con...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Test/unitTest_OfficeWebApps.ps1
unitTest_OfficeWebApps.ps1
Function WriteLine { log "" log "------------------------------------------------------------------------------------------------------------" } Function GetFromNode([System.Xml.XmlElement]$node, [string] $item) { $value = $node.GetAttribute($item) If ($value -eq "") { $child = $...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Install/Install-WAC2013Update.ps1
Install-WAC2013Update.ps1
Param( [string] $scriptPath, [string] $patchLocation, [string] $patches ) function Stop-Services() { ####################### ##Stop Other Services## ####################### Set-Service -Name "IISADMIN" -startuptype Disabled log "INFO: Gracefully stopping IIS W3WP P...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Install/Execute-InstallWAC2013Update.ps1
Execute-InstallWAC2013Update.ps1
Param( [string] $scriptPath ) ################################################################################################# # Author: Marina Krynina # Desc: Functions to support installation of SharePoint updates ############################################################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Install/Install-OWA2013.ps1
Install-OWA2013.ps1
############################################################################################ # Author: Marina Krynina # Desc: Functions to support installation of SharePoint 2013 # Updates: # 2015-11-12 ################################################################################################# ###...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_StopServices.ps1
OfficeWebApps_StopServices.ps1
#Stop Services Set-Service -Name "IISADMIN" -startuptype Disabled iisreset -stop -noforce
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_JoinFarm.ps1
OfficeWebApps_JoinFarm.ps1
Import-Module OfficeWebApps New-OfficeWebAppsMachine –MachineToJoin DEVAPPSYD005W.devraus01.cscmws.com
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_RemoveOfficeWebAppsMachine.ps1
OfficeWebApps_RemoveOfficeWebAppsMachine.ps1
Import-Module OfficeWebApps Remove-OfficeWebAppsMachine
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_CreateNewFarm.ps1
OfficeWebApps_CreateNewFarm.ps1
Import-Module OfficeWebApps New-OfficeWebAppsFarm -CacheLocation "E:\Program Files\Microsoft\OfficeWebApps\Working\d\" -CacheSizeInGB 15 -CertificateName "MWS2R2 OfficeApps" -InternalURL "officeapps.mwsaust.net" -ExternalUrl "officeapps.mwsaust.net" -LogLocation "L:\LogFiles\OfficeWebApps\ULS" -LogRetent...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_StartServices.ps1
OfficeWebApps_StartServices.ps1
#Start Services Set-Service -Name "IISADMIN" -startuptype Automatic $iissrv = get-service "IISADMIN" $iissrv.start()
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_CheckFarm.ps1
OfficeWebApps_CheckFarm.ps1
Import-Module OfficeWebApps (Get-OfficeWebAppsFarm).Machines
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/ManualPatchingScripts/OfficeWebApps_CheckVersion.ps1
OfficeWebApps_CheckVersion.ps1
Import-Module OfficeWebApps (Invoke-WebRequest https://OfficeApps.MWSAust.NET/op/servicebusy.htm).Headers["X-OfficeVersion"]
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Config/Configure-OWA2013.ps1
Configure-OWA2013.ps1
Param( [string] $scriptPath, [string] $inputFile ) ################################################################################################# # Author: Marina Krynina # Desc: Functions to import SSL certificates. This function is obsolete ###########################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Config/Remove-WAC2013Server.ps1
Remove-WAC2013Server.ps1
############################################################################################ # Main ############################################################################################ # Load Common functions . .\FilesUtility.ps1 . .\PlatformUtils.ps1 . .\VariableUtility.ps1 . .\LaunchProcess.ps1 Set-Locatio...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Config/admin_GetWACVersion.ps1
admin_GetWACVersion.ps1
(Invoke-WebRequest https://OfficeAppsclient0.mwsaust.net/m/met/participant.svc/jsonAnonymous/BroadcastPing).Headers["X-OfficeVersion"]
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Config/Execute-RemoveWAC2013Server.ps1
Execute-RemoveWAC2013Server.ps1
Param( [string] $scriptPath ) ############################################################################### # Author: Kulothunkan Palasundram # Desc: Functions to support removal of office web apps server from farm # Main ############################################################################### # Loa...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Config/Execute-OWA2013Configuration.ps1
Execute-OWA2013Configuration.ps1
# MWS2R2 - OWA 2013 Configure ########################################################################################## # Author: Marina Krynina # Desc: The script is based on the script provided by ServiceMesh # Updates: # 2015-01-16 Configures OWA farm #####################################################...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/Config/admin_CreateSelfSignedCert.ps1
admin_CreateSelfSignedCert.ps1
# Client 0 New-SelfSignedCertificate -DnsName OfficeAppsClient0.mwsaust.net,devappsyd015w.devraus01.cscmws.com -CertStoreLocation Cert:\LocalMachine\My # Demo New-SelfSignedCertificate -DnsName OfficeApps.mwsaust.net,devappsyd005w.devraus01.cscmws.com,devappsyd006w.devraus01.cscmws.com -CertStoreLocation Cert:\Loc...
PowerShellCorpus/Github/sskoklev_Structure2/Production/OfficeWebApps2013/TestFramework/UnitTest-Server-OfficeWebApps.ps1
UnitTest-Server-OfficeWebApps.ps1
Param( [string] $scriptPath, [string] $testFolder ) ############################################################################################ # Author: Marina Krynina # Desc: Server side Unit testing - Office Web Apps #####################################################################################...
PowerShellCorpus/Github/OPS-E2E-Prod_E2E_P_D_Provision_2017_5_26_12_35_5/.openpublishing.build.ps1
.openpublishing.build.ps1
param( [string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1", [string]$parameters ) # Main $errorActionPreference = 'Stop' # Step-1: Download buildcore script to local echo "download build core script to local with source url: ...
PowerShellCorpus/Github/syspeople-dp_Test-Repo/Convert-ScriptToTemplate.ps1
Convert-ScriptToTemplate.ps1
function Add-Dollar { param( [Parameter(ValueFromPipeline=$True)] $string ) if($string -like "*$*"){ $string=$string.Replace('$','$$') } return $string } $path="C:\Users\Daniel\Desktop\" Remove-Item $path\output.txt Get-Content -Path $path\input.txt | ForEach-Object -...
PowerShellCorpus/Github/syspeople-dp_Test-Repo/Simple-Function.ps1
Simple-Function.ps1
<# .NOTES =========================================================================== Created by: CreatedBy Organization: Company Filename: FileName =========================================================================== DESCRIPTION Description...
PowerShellCorpus/Github/syspeople-dp_Test-Repo/ReceiveFromGit.ps1
ReceiveFromGit.ps1
$RepositoryZipUrl = "https://api.github.com/repos/syspeople-dp/Test-Repo/zipball/master" $ZipFile = "C:\BIN\Repo.zip" $OutputFolder = "C:\BIN\Repo" $SnippetsFolder="$env:APPDATA\Code\User\snippets" if(Test-Path -Path $OutputFolder){ Remove-Item -Path $OutputFolder -Recurse -Force } # download the zip ...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/2SelectViaAstDemo4.ps1
2SelectViaAstDemo4.ps1
# # Using Select-ViaAST to find other just Parameters # cls Select-ViaAST -Fullname .\test.ps1 -Parameter | Format-Table -AutoSize
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demoA.ps1
1demoA.ps1
# # Scriptblocks, Ast.FindAll and FunctionDefinitionAst # cls { #This is function test1 function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use }.Ast.FindAll( { $args[0] -is [System.Management.Automation.L...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo5.ps1
1demo5.ps1
# # Getting Tokens # # Filtering, goal is to get all the names of the functions # cls $script= @' function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} '@ [ref]$errors=$null $tokens = [System.Management.Automation.PSParser]::Tokenize($script, $errors) $tokens | Where Type -ma...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/3PSharpDemo1.ps1
3PSharpDemo1.ps1
. .\Select-ViaAST.ps1 [xml]$MainWindow=@' <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStartupLocation="CenterScreen" Title="PSHarp" Height="550" Width="825"> <Grid> <Grid.RowDef...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo3b.ps1
1demo3b.ps1
sl c: ls | ? {$_} | % { ps gsv '1+1'|iex }
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/2SelectViaAstDemo2.ps1
2SelectViaAstDemo2.ps1
# # Using Select-String # # See the noise cls Select-String function .\test.ps1
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/2SelectViaAstDemo1.ps1
2SelectViaAstDemo1.ps1
# # Let's look at the script we are searching # cls notepad.exe .\test.ps1
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/test.ps1
test.ps1
$users = @{} # This is the Add-User function function Add-User { param($UserName) $users.$UserName=$null } function Remove-User { <# .Synopsis This function removes a user #> param($UserName) $users.Remove($UserName) } function Find-User { param($...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/3PSharpDemo3.ps1
3PSharpDemo3.ps1
Import-Module .\psharp\psharp.psm1 -Force psEdit .\test.ps1
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/Select-ViaAST.ps1
Select-ViaAST.ps1
function Select-ViaAST { param( $Pattern, [Parameter(ValueFromPipeLineByPropertyName)] $Fullname, [Switch]$Function, [Switch]$Variable, [Switch]$Parameter ) Begin { function New-ASTItem ($ItemType, $Name, $Fullname, $Extent...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo7.ps1
1demo7.ps1
# # Getting Tokens # # A solution to too much noise # cls $script= @' #This is function test1 function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use '@ [ref]$errors=$null $tokens = [System.Management.Automation.PSParser]::Tok...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/2SelectViaAstDemo5.ps1
2SelectViaAstDemo5.ps1
# # Using Select-ViaAST to find # several # cls Select-ViaAST -Fullname .\test.ps1 | Select-Object * -ExcludeProperty line | Format-Table -AutoSize
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demoD.ps1
1demoD.ps1
# # Find all parameter/function definitions # # Not ParamBlocks cls { function test1 ($test1Parameter) {} function test2 ($test2Parameter) {} function test3 ($test3Parameter) {} filter test4 ($filterParameter) {} workflow test5 ($workflowParameter) {} net use ...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo3.ps1
1demo3.ps1
# # More Getting Tokens # # Different white space # cls $script= @' $x = 3 * ( $y - $z ) '@ [ref]$errors=$null $tokens = [System.Management.Automation.PSParser]::Tokenize($script, $errors) $tokens | Format-Table -AutoSize
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo9.ps1
1demo9.ps1
# # Refining the select string # # $script= @' #This is function test1 function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use '@ cls $r = ($script -split "`r`n") | Select-String "^function\s+(?<functionName>\w+)" $r...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo1.ps1
1demo1.ps1
# # The AST at work # # Helping you be productive # # Showing errors $result = Get-Process $result. function X { function Y { param( $a, $a ) }
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demoB.ps1
1demoB.ps1
# # Expanded FunctionDefinitionAst. Filters and Workflows # cls { #This is function test1 function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use }.Ast.FindAll({$args[0] -is [System.Management.Automation.Lan...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo6.ps1
1demo6.ps1
# # Getting Tokens # # Function|Workflow|Filter # # Too much noise # cls $script= @' function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use '@ [ref]$errors=$null $tokens = [System.Management.Automation.PSParser]::Tokenize(...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo2.ps1
1demo2.ps1
# # Getting Tokens # # Who, What and Where # cls $script= "1 + 1" [ref]$errors=$null [System.Management.Automation.PSParser]::Tokenize($script, $errors) | Format-Table -AutoSize
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo4.ps1
1demo4.ps1
# # More Getting Tokens # # Functions etc # cls $script= @' function test ($p) { Test-Path $p } '@ [ref]$errors=$null [System.Management.Automation.PSParser]::Tokenize($script, $errors) | Format-Table -AutoSize
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demoC.ps1
1demoC.ps1
# # Ast Parse, Input|File # cls $script = @" #This is function test1 function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use "@ [ref]$tokens=$null [ref]$errors=$null $ast = [System.Management.Automati...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo3a.ps1
1demo3a.ps1
Function Expand-Alias { $Editor=$psISE.CurrentFile.Editor $script=$Editor.Text [ref]$errors=$null [System.Management.Automation.PsParser]::Tokenize($script, $errors) | Where { $_.Type -eq 'Command'} | Sort StartLine, StartColumn -Desc | ForEach { if($_.Content...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/1demo8.ps1
1demo8.ps1
# # Using select string # $script= @' #This is function test1 function test1 ($p) {} function test2 ($p) {} function test3 ($p) {} filter test4 ($p) {} workflow test5 ($p) {} net use '@ cls ($script -split "`r`n") | Select-String function
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/3PSharpDemo2.ps1
3PSharpDemo2.ps1
# # Using ShowUI # # Import-Module ShowUI . .\Select-ViaAST.ps1 New-Window -Show -WindowStartupLocation CenterScreen -FontSize 20 -On_Loaded ` { $Results.ItemsSource = Select-ViaAST -Fullname .\test.ps1 } ` { New-ListView -Name Results -View { New-GridView { ...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/2SelectViaAstDemo3.ps1
2SelectViaAstDemo3.ps1
# # Using Select-ViaAST to find functions # # See the signal cls . .\Select-ViaAST.ps1 Select-ViaAST -Fullname .\test.ps1 -Function | Select * -ExcludeProperty Line | Format-Table -AutoSize
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/psharp/Install.ps1
Install.ps1
param([string]$InstallDirectory) $fileList = @( 'ConvertTo-PSCustomObject.ps1', 'New-FunctionFromSelectedText.ps1', 'Edit-Live.ps1', 'psharp.psm1' ) if ('' -eq $InstallDirectory) { $personalModules = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath WindowsPower...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/psharp/New-FunctionFromSelectedText.ps1
New-FunctionFromSelectedText.ps1
function New-FunctionFromSelectedText { function Get-VariableExtentText { param ( [parameter(ValueFromPipeline)] [System.Management.Automation.Language.Ast] $ast ) begin { $VariablesToExclude = '$_', '$true', '$false', '...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/psharp/Edit-Live.ps1
Edit-Live.ps1
function Edit-Live { param( [Parameter(Mandatory)] [string]$Name ) $Definition = (Get-Command $Name -ErrorAction SilentlyContinue ).Definition if($Definition) { $ISEFile=$psISE.CurrentPowerShellTab.Files.Add() $psISE.CurrentPowerShellTab.Files.SetSelectedFile(...
PowerShellCorpus/Github/dfinke_PowerShellASTDemo/DemoScripts/psharp/ConvertTo-PSCustomObject.ps1
ConvertTo-PSCustomObject.ps1
function ConvertTo-PSCustomObject { function New-ParamStmt { param($tokens) $newList = $tokens| ForEach {"`t`$"+$_} @" param( $($newList -join ",`r`n") ) "@ } function New-PSCustomObject { param($tokens) $newList = $tokens| ForEach { "`t{0}...
PowerShellCorpus/Github/DevOpsInc_Powershell/File Manager/res.ps1
res.ps1
function Get-ScriptDirectory { $Invocation = (Get-Variable MyInvocation -Scope 1).Value Split-Path $Invocation.MyCommand.Path } function ReadSettings($directory) { $SettingsDir = $directory + "\" + "settings.json" return Get-Content $SettingsDir } function GetSettings([string]$dir) { ...
PowerShellCorpus/Github/DevOpsInc_Powershell/Web Config Validator/validate.ps1
validate.ps1
{\rtf1}
PowerShellCorpus/Github/GreatBuddhaBelly_StudentLunchBalance/StudentConcatFinalCut.ps1
StudentConcatFinalCut.ps1
<################################################################################### # Student Balance Concatenate Script # Takes a modified .csv pulled from the district # 6 column format in .csv to be imported: StudentID, First Name, Last Name, Address, # Phone Number, and Balance # # Ouputs a new .csv of just ...
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_D_Provision_2017_5_4_23_59_4/.openpublishing.build.ps1
.openpublishing.build.ps1
param( [string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1", [string]$parameters ) # Main $errorActionPreference = 'Stop' # Step-1: Download buildcore script to local echo "download build core script to local with source url: ...
PowerShellCorpus/Github/Raikia_Get-ReconInfo/Get-ReconInfo.ps1
Get-ReconInfo.ps1
#requires -version 2 <# Get-ReconInfo File: Get-ReconInfo.ps1 Author: Chris King (@raikiasec) #> function Get-ReconInfo { <# .SYNOPSIS Lists connections and relevant info about a system Author: Chris King (@raikiasec) .DESCRIPTION This script runs the following...