full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/beanxyz_Powershell/IE AutoLogin.ps1
IE AutoLogin.ps1
$Url = "https://10.2.1.18/admin/login.jsp” $Username=”admin” $Password=”Adv#rtis3th!S” $IE = New-Object -com internetexplorer.application; $IE.visible = $true; $IE.navigate($url); # Wait a few seconds and then launch the executable. while ($IE.Busy -eq $true) { Start-Sleep -s 2; } # if($IE...
PowerShellCorpus/Github/beanxyz_Powershell/Get-Software.ps1
Get-Software.ps1
function Get-Software{ [cmdletbinding()] param( [parameter(mandatory=$true,position=1)][string]$software, [string]$computername="*", [string]$OS='*' ) Write-Verbose "Scanning Computers..." if($computername -ne '*'){ $a=Get-ADComputer -Filter "name -like '*$computername*' " -Properties operatingsy...
PowerShellCorpus/Github/beanxyz_Powershell/Update-UPN.ps1
Update-UPN.ps1
Import-Module ActiveDirectory $ADUsers = Get-ADUser 'arojas' #Change User SamAccountName and User Principal Name foreach ($ADUser in $ADUsers) { $GivenName = $ADUser.GivenName $SurName = $ADUser.Surname if (($GivenName -ne $null) -or ($SurName -ne $null)) { $newSAM = $GivenName.ToLower() + '.'+$S...
PowerShellCorpus/Github/beanxyz_Powershell/Practise.ps1
Practise.ps1
function Get-SystemInfo { [CmdletBinding()] param( [string[]]$ComputerName, [string]$ErrorLog ) BEGIN { } PROCESS { foreach ($computer in $computername) { $os = Get-WmiObject -class Win32_OperatingSystem ` -computerName $computer $comp = Get-WmiObject -class Win32_ComputerSystem ` -computerName $computer ...
PowerShellCorpus/Github/beanxyz_Powershell/Get-EmailAddress.ps1
Get-EmailAddress.ps1
#########################Get Prmiary rapp email Only############# $users = Get-ADUser -Filter {proxyAddresses -like '*rapp*'} -Properties proxyAddresses -SearchBase "ou=sydney,dc=omnicom,dc=com,dc=au" $pp=$null $pp=@{'name'=$null;'primarysmtp'=$null} $obj=New-Object -TypeName psobject -Property $pp $result=@(...
PowerShellCorpus/Github/beanxyz_Powershell/10March.ps1
10March.ps1
$day=get-date "03/10/2017" #get user lists who were created before 10 March $user1=Get-ADUser -filter {whencreated -lt $day} -SearchBase “ou=melbourne,dc=omnicom,dc=com,dc=au” -Properties *| select name, samaccountname, @{n='lastlogontime';e={[datetime]::FromFileTime($_.lastlogon)}},mail, company,whencreated, enabl...
PowerShellCorpus/Github/beanxyz_Powershell/Test-SwitchOption.ps1
Test-SwitchOption.ps1
function Get-Bios { <# .Synopsis Get-Bios Test .DESCRIPTION Long description .EXAMPLE "localhost","sydit01" | get-bios .EXAMPLE get-bios -computername "localhost","sydittest","notexist" -verbose -error .INPUTS Inputs to this cmdlet (if any) .OUTPUTS Output from this cmdlet (if any) .N...
PowerShellCorpus/Github/beanxyz_Powershell/Swap SMTP.ps1
Swap SMTP.ps1
$result=@() $users=get-aduser -Filter {proxyaddresses -like "*rapp.com.au*"} -Properties proxyaddresses -SearchBase "ou=rapp,ou=ddb_group,ou=melbourne,dc=omnicom,dc=com,dc=au" foreach( $user in $users){ foreach ($address in $user.proxyAddresses) { if($address -like "*@rapp.com.au*"){ $rappaddress=$ad...
PowerShellCorpus/Github/beanxyz_Powershell/Untitled11.ps1
Untitled11.ps1
Send-MailMessage slkdjfkls
PowerShellCorpus/Github/beanxyz_Powershell/join-object.ps1
join-object.ps1
function AddItemProperties($item, $properties, $output) { if($item -ne $null) { foreach($property in $properties) { $propertyHash =$property -as [hashtable] if($propertyHash -ne $null) { $hashName=$propertyHash[“name”] -as [string] ...
PowerShellCorpus/Github/beanxyz_Powershell/Untitled1.ps1
Untitled1.ps1
#设置搜索的时间段和发件人 $dateEnd = get-date $dateStart = $dateEnd.AddDays(-2) $recipient="andrew.little@aus.ddb.com" #自定义时间,转换时区 Get-MessageTrace -StartDate $dateStart -EndDate $dateEnd -RecipientAddress $recipient| Select-Object @{name='time';e={[System.TimeZone]::CurrentTimeZone.ToLocalTime($_.received)}}, Se...
PowerShellCorpus/Github/beanxyz_Powershell/MarchScriptingGame.ps1
MarchScriptingGame.ps1
function Get-Diacritic { [CmdletBinding()] Param ( # Param1 help description [Parameter( ValueFromPipelineByPropertyName=$true, Position=0)] $Path=".\" ) Begin { } Process { Get-Ch...
PowerShellCorpus/Github/beanxyz_Powershell/Warning-Netapp.ps1
Warning-Netapp.ps1
function sendmail(){ Write-host "Sending Emails to the Administrtor" $from = "ddbhelpdesk@aus.ddb.com" $to = "yuan.li@syd.ddb.com" $smtp = "smtp.office365.com" $sub = "Volume over 90%" $body="This is the warning message for volume usage over 90%" $secpasswd = ConvertTo-SecureString "Pass2014" -AsPlainTe...
PowerShellCorpus/Github/beanxyz_Powershell/WordPress.ps1
WordPress.ps1
#创建高可用博客逻辑   #Prepare Network #1.创建EC2-S3的Role #IAM Role $policy1=@" { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } "@ New-IAMRole -RoleName "EC2...
PowerShellCorpus/Github/beanxyz_Powershell/Unlock.ps1
Unlock.ps1
#ERASE ALL THIS AND PUT XAML BELOW between the @" "@ $inputXML = @" <Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2...
PowerShellCorpus/Github/beanxyz_Powershell/Get-DeliveryInfo.ps1
Get-DeliveryInfo.ps1
<# .Synopsis Short description .DESCRIPTION Long description .EXAMPLE Example of how to use this cmdlet .EXAMPLE Another example of how to use this cmdlet .INPUTS Inputs to this cmdlet (if any) .OUTPUTS Output from this cmdlet (if any) .NOTES General notes .COMPONENT The componen...
PowerShellCorpus/Github/beanxyz_Powershell/Get-UptimeJanGame.ps1
Get-UptimeJanGame.ps1
function Get-Uptime{ <# .Synopsis Get machine uptime from remtoe machine .DESCRIPTION Get machine from remtoe machine .EXAMPLE Get-Uptime sydav01,sydit01 This will get the up time of server sydav01 and sydit01 .INPUTS String name of server names .OUTPUTS Output from this cmdlet (if any) ....
PowerShellCorpus/Github/beanxyz_Powershell/Recusively Change Folder Permssion.ps1
Recusively Change Folder Permssion.ps1
#enable NTFS inheritance permission function function Set-NTFSInheritance { <# .SYNOPSIS Enable or Disable the NTFS permissions inheritance. .DESCRIPTION Enable or Disable the NTFS permissions inheritance on files and/or folders. .EXAMPLE $Folders = Get-Chil...
PowerShellCorpus/Github/beanxyz_Powershell/Untitled2.ps1
Untitled2.ps1
function Set-NTFSInheritance { <# .SYNOPSIS Enable or Disable the NTFS permissions inheritance. .DESCRIPTION Enable or Disable the NTFS permissions inheritance on files and/or folders. .EXAMPLE $Folders = Get-Childitem -Path 'e:\homedirs' | Where-Object {$_.Att...
PowerShellCorpus/Github/beanxyz_Powershell/Get-LockOut.ps1
Get-LockOut.ps1
function get-lockout{ $eventcritea = @{logname='security';id=4740} $Events =get-winevent -ComputerName (Get-ADDomain).pdcemulator -FilterHashtable $eventcritea #$Events = Get-WinEvent -ComputerName syddc01 -Filterxml $xmlfilter # Parse out the event message data ForEa...
PowerShellCorpus/Github/beanxyz_Powershell/Get-Table.ps1
Get-Table.ps1
$web = 'http://www.proxylisty.com/country/Australia-ip-list' $template = @' <tr> <td>{IP*:203.56.188.145}</td> <td><a href='http://www.proxylisty.com/port/8080-ip-list' title='Port 8080 Proxy List'>{Port:8080}</a></td> <td>HTTP</td> <td><a style='color:red;' href='http://www.proxylisty.com/anonymity/High ...
PowerShellCorpus/Github/beanxyz_Powershell/Restart-WSUSComputers.ps1
Restart-WSUSComputers.ps1
#$names=@("sydit01","aussql01","camperdown","drdc01","drdc02","drrad2012","drsrm2012","kensington","melal02","melapp01","melbk01","meldc01","meldv01","meldv02","meleps01","melex01","melfs01","melfs02","melic01","melit02","melps01","yarra","melbk01","melvcs","manly","mascot","ryde","stanmore","sydarc01","sydbcc01","sydb...
PowerShellCorpus/Github/beanxyz_Powershell/aws.ps1
aws.ps1
#Install and import module import-module AWSPowerShell get-module AWSPowershell #Create account from IAM, download user accesskey and secretkey #Generate, list and delete profile Set-AWSCredentials -AccessKey AKIAJADKXIQBE5SXVHRQ -SecretKey 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 -StoreAs myprofile Get-AWSCred...
PowerShellCorpus/Github/beanxyz_Powershell/Update-PhoneNumber.ps1
Update-PhoneNumber.ps1
#$a=import-csv -header name, title, mobile, ipphone C:\Users\yli\Downloads\name1.csv $a=import-csv C:\temp\list.csv foreach ($b in $a ) { $c=$b.UserName $d=$b.Mobile if ($d){ set-aduser $c -MobilePhone $d -ErrorVariable ee #get-aduser $c -Properties name,mobile | foreach {Set-ADUser $_ -Replace...
PowerShellCorpus/Github/beanxyz_Powershell/HealthReminder.ps1
HealthReminder.ps1
$scriptblock={ while($true){ $MessageboxTitle = “Health Reminder” $Messageboxbody = “Please have a break, my lord” $MessageIcon = [System.Windows.MessageBoxImage]::Information $ButtonType = [System.Windows.MessageBoxButton]::OK [System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$mess...
PowerShellCorpus/Github/beanxyz_Powershell/Get-OUSendMail.ps1
Get-OUSendMail.ps1
function Get-PrimarySMTP(){ [CmdletBinding()] Param ( # Param1 help description [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] [string[]] $users ) $pp=$null $pp=@{'name'=$null;'...
PowerShellCorpus/Github/beanxyz_Powershell/UploadImg.ps1
UploadImg.ps1
#Set-UserPhoto "yuan li" -PictureData([system.io.file]::ReadAllBytes("C:\users\yli\Desktop\baby.jpg")) #$UserCredential = Get-Credential #Connect-MsolService -Credential $UserCredential #$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/...
PowerShellCorpus/Github/beanxyz_Powershell/Ch6Lab.ps1
Ch6Lab.ps1
#LabA $here = Split-Path -Parent $MyInvocation.MyCommand.Path $here function Get-ComputerInfo { <# .Synopsis Short description .DESCRIPTION Get Computer Info .EXAMPLE Get-ComputerInfo -ComputerName "sydav01","sydit01" Get Computer Info from multiple computers .EXAMPLE "Localhost" | Get-Com...
PowerShellCorpus/Github/beanxyz_Powershell/ListAllSharedFolderPermission.ps1
ListAllSharedFolderPermission.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, ...
PowerShellCorpus/Github/beanxyz_Powershell/Invoke-Parallel.ps1
Invoke-Parallel.ps1
function Invoke-Parallel { <# .SYNOPSIS Function to control parallel processing using runspaces .DESCRIPTION Function to control parallel processing using runspaces Note that each runspace will not have access to variables and commands loaded in your session or in other run...
PowerShellCorpus/Github/beanxyz_Powershell/Move-Computers.ps1
Move-Computers.ps1
$a=Get-ADComputer -SearchBase "ou=test,ou=windows,ou=ddb group workstations,ou=ddb group machines,dc=omnicom,dc=com,dc=au" -Filter * -Properties * | select name, ipv4address, operatingsystem foreach($b in $a){ $b.IPv4Address if($b.IPv4Address -like "10.2*" -or $b.IPv4Address -like "172.16*"){ switch($b.Operat...
PowerShellCorpus/Github/beanxyz_Powershell/ScanWannaCry.ps1
ScanWannaCry.ps1
#Version 1.08.00 @KieranWalsh May 2017 # Computer Talk LTD # Thanks to https://github.com/TLaborde, and https://www.facebook.com/BlackV for notifying me about missing patches. $OffComputers = @() $CheckFail = @() $Patched = @() $Unpatched = @() $log = Join-Path -Path ([Environment]::GetFolderPath('MyDocume...
PowerShellCorpus/Github/beanxyz_Powershell/Upddate-NSCP.ps1
Upddate-NSCP.ps1
#Get Connected servers from AD Write-Host "Scanning Online Servers ..." $a=get-adcomputer -filter {operatingsystem -like "*20*"} $computers=@() foreach ($b in $a ){ if(Test-Connection -computername $b.name -Count 1 -Quiet){ $temp=[psobject]@{'name'=$b.name} $computers+=$temp } } Write-Host...
PowerShellCorpus/Github/beanxyz_Powershell/Invoke-PasswordRoll.ps1
Invoke-PasswordRoll.ps1
function Invoke-PasswordRoll { <# .SYNOPSIS This script can be used to set the local account passwords on remote machines to random passwords. The username/password/server combination will be saved in a CSV file. The account passwords stored in the CSV file can be encrypted using a password of the administrators...
PowerShellCorpus/Github/beanxyz_Powershell/Get-UserAndGroupInfo.ps1
Get-UserAndGroupInfo.ps1
function Get-localuser{ $adsi = [ADSI]"WinNT://$env:COMPUTERNAME" $adsi.Children | where {$_.SchemaClassName -eq 'user'} | select name,Lastlogin } function Get-localuserGroup{ $eventcritea = @{logname='security';id=4732} $Events =get-winevent -ComputerName $env:COMPUTERNAME -FilterHashtable $eventcri...
PowerShellCorpus/Github/beanxyz_Powershell/Get-VMInfoESXi.ps1
Get-VMInfoESXi.ps1
Connect-viserver sydvcs2012 get-VM | select version,Name, powerstate, numcpu, Memorygb, @{N="IP Address";E={@($_.guest.IPAddress[0])}},@{n="OS";e={$_.guest.osfullname}}, @{n="scsi";e={(Get-ScsiController $_.name).type}} | tee -variable result $result | sort scsi Disconnect-VIServer
PowerShellCorpus/Github/beanxyz_Powershell/FindServerIsPendingReboot.ps1
FindServerIsPendingReboot.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, ...
PowerShellCorpus/Github/beanxyz_Powershell/query-user.ps1
query-user.ps1
<# .Synopsis Short description .DESCRIPTION Long description .EXAMPLE queryuser -server sydav01 .EXAMPLE Another example of how to use this cmdlet .INPUTS Inputs to this cmdlet (if any) .OUTPUTS Output from this cmdlet (if any) .NOTES General notes .COMPONENT The component thi...
PowerShellCorpus/Github/beanxyz_Powershell/Get-Uptime.ps1
Get-Uptime.ps1
function Get-Uptime{ <# .Synopsis Get machine uptime from remtoe machine .DESCRIPTION Get machine from remtoe machine .EXAMPLE Get-Uptime sydav01,sydit01 This will get the up time of server sydav01 and sydit01 .INPUTS String name of server names .OUTPUTS Output from this cmdlet (if any) ....
PowerShellCorpus/Github/beanxyz_Powershell/Get-EventID.ps1
Get-EventID.ps1
[xml]$xmlFilter = @" <QueryList> <Query Id="0" Path="Application"> <Select Path="Application">*[System[(EventID=1002) and TimeCreated[timediff(@SystemTime) &lt;= 604800000]]]</Select> </Query> </QueryList> “@ #Get-WinEvent -ComputerName $DC.DC -LogName Security -FilterXPath "*[System[(EventID=529 or Ev...
PowerShellCorpus/Github/beanxyz_Powershell/Delete-exitusers based on spreedsheet.ps1
Delete-exitusers based on spreedsheet.ps1
$a=import-csv C:\temp\exituser.csv -Header "Names","LastName","FirstName","Date","Reason","Place","Type","Company" foreach( $b in $a ){ $name=$b.FirstName.Substring(0,1)+$b.LastName try{ get-aduser $name | Remove-ADUser } catch{ $warning="User "+$name+" doesn't exist" $warning |Write-Warning } }
PowerShellCorpus/Github/beanxyz_Powershell/Get-DotNet.ps1
Get-DotNet.ps1
function get-dotnet { <# .Synopsis Get .net and Powershell Version from remtoe machine .DESCRIPTION Get .net and Powershell and OS Version from remtoe machine .EXAMPLE get-dotnet -osname 2012 This will get the .net, powershell and OS version of connected Windows 2012 Server .EXAMPLE get-dot...
PowerShellCorpus/Github/beanxyz_Powershell/Get-Pingstatus.ps1
Get-Pingstatus.ps1
function ComputerStatus{ param( [string]$os1=200 ) $a="*"+$os1+"*" Get-ADComputer -Filter{(operatingsystem -like $a) } -Properties operatingsystem,ipv4address | sort operatingsystem| select name, operatingsystem, @{name="status";expression={if(Test-Connection -ComputerName $_.name -count 1 -quiet ){ret...
PowerShellCorpus/Github/beanxyz_Powershell/New-HTMLSystemReport.ps1
New-HTMLSystemReport.ps1
#Import-Module c:\users\yli\Documents\Windowspowershell\modules\enhancedhtml2#requires -module EnhancedHTML2 <# .SYNOPSIS Generates an HTML-based system report for one or more computers. Each computer specified will result in a separate HTML file; specify the -Path as a folder where you want the files written. ...
PowerShellCorpus/Github/beanxyz_Powershell/单号查询/Globals.ps1
Globals.ps1
#-------------------------------------------- # Declare Global Variables and Functions here #-------------------------------------------- #Sample function that provides the location of the script function Get-ScriptDirectory { <# .SYNOPSIS Get-ScriptDirectory returns the proper location of the script. ...
PowerShellCorpus/Github/beanxyz_Powershell/单号查询/单号查询.Export.ps1
单号查询.Export.ps1
#------------------------------------------------------------------------ # Source File Information (DO NOT MODIFY) # Source ID: 79834c25-a4eb-4ac2-901b-b4f1d9eb5e98 # Source File: ..\单号查询.psproj #------------------------------------------------------------------------ #region Project Recovery Data (DO NOT MODIFY)...
PowerShellCorpus/Github/beanxyz_Powershell/Software/Globals.ps1
Globals.ps1
#-------------------------------------------- # Declare Global Variables and Functions here #-------------------------------------------- #Sample function that provides the location of the script function Get-ScriptDirectory { <# .SYNOPSIS Get-ScriptDirectory returns the proper location of the script. ...
PowerShellCorpus/Github/beanxyz_Powershell/Software/Software.Export.ps1
Software.Export.ps1
#------------------------------------------------------------------------ # Source File Information (DO NOT MODIFY) # Source ID: d3fa81a3-d18b-45a8-9072-35bfeb5eae26 # Source File: ..\Software.psproj #------------------------------------------------------------------------ #region Project Recovery Data (DO NOT MOD...
PowerShellCorpus/Github/OPSTest_E2E_Provision_1484820083519/.openpublishing.build.ps1
.openpublishing.build.ps1
param( [string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.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 u...
PowerShellCorpus/Github/MarcusFelling_PowerShell/AWS_ASG_EnterStandby.ps1
AWS_ASG_EnterStandby.ps1
# Part 1 of 2 # Part 1 Places EC2 instance into autoscaling group's standby mode. # Part 2 Exits standby mode and waits for instance to be InService. param ( [Parameter(Mandatory=$true)][string]$ASGNameVariable # Passed in deploy step, example: WebASGName. ) # Get EC2 Instance Try { $response = Invoke-Re...
PowerShellCorpus/Github/MarcusFelling_PowerShell/Octopus_UpdateVariable.ps1
Octopus_UpdateVariable.ps1
# Script to update Octopus Variable via Octopus API param( [string]$global:VarName, # Variable name to update. Passed via Build definition [string]$global:newvalue, # New value for variable. Passed via Build definition [string]$global:APIKey # Octopus APIKey passed as encrypted build variable ) Function UpdateO...
PowerShellCorpus/Github/MarcusFelling_PowerShell/IIS_SetPropertiesForFasterStartup.ps1
IIS_SetPropertiesForFasterStartup.ps1
#Sets IIS properties for faster load times #Load IIS Module if not loaded already Function WebAdministration-VerifyModule { If ( ! (Get-module WebAdministration )) { Try { Import-Module WebAdministration } Catch { Write-Host "Excepti...
PowerShellCorpus/Github/MarcusFelling_PowerShell/O365_UndeliverableMessageExport.ps1
O365_UndeliverableMessageExport.ps1
<# .Synopsis X Mailbox Undeliverable message export and filter .DESCRIPTION This script uses ExportOSCEXOEmailMessage PowerShell module (in addition to the Exchange Web API) to connect to the O365 X mailbox, search for emails according to X criteria during the last week, exports them, filters the em...
PowerShellCorpus/Github/MarcusFelling_PowerShell/SSIS_DeployISPAC.ps1
SSIS_DeployISPAC.ps1
# Script to deploy SSIS package (ISPAC) # ISPAC is built using devenv.exe # Use computer name to get IP then store in $server variable for connection string below $server = $env:computername $ips = [System.Net.Dns]::GetHostAddresses($server)[0].IPAddressToString; $server = $ips write-host "Server IP:" $server ...
PowerShellCorpus/Github/MarcusFelling_PowerShell/AWS_ASG_ExitStandby.ps1
AWS_ASG_ExitStandby.ps1
# Part 2 of 2 # Part 1 Places EC2 instance into autoscaling group's standby mode. # Part 2 Exits standby mode and waits for instance to be InService. param ( [Parameter(Mandatory=$true)][string]$ASGEnterStandbyDeployStep, # Deploy step name of AWS_ASG_EnterStandby.ps1 [Parameter(Mandatory=$true)][string]...
PowerShellCorpus/Github/MarcusFelling_PowerShell/GenerateAzureSASKey.ps1
GenerateAzureSASKey.ps1
$storageAccountName = "" $storageAccountKey = "" $container = "" $context = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey $sas = New-AzureStorageContainerSASToken -Name $container -Permission rl -Context $context -ExpiryTime ([DateTime]::UtcNow.AddDays(7)) ...
PowerShellCorpus/Github/MarcusFelling_PowerShell/JBoss_FTPUploadLogs.ps1
JBoss_FTPUploadLogs.ps1
# Uploads desired logs to FTP site # Requires PowerShell V 3.0, 7-Zip #UI Settings $a = (Get-Host).UI.RawUI $b = $a.WindowSize $b.Width = 60 $b.Height = 30 $a.WindowSize = $b [int]$serverNumber = read-host "Upload logs to FTP`n1-Grp-Test`n2-iGrp-Test`n3-Grp-Stage`n4-iGrp-Stage`n5-Grp-Production`n6-iGrp-Prod...
PowerShellCorpus/Github/MarcusFelling_PowerShell/TFS_UpdateWorkItemsWithBuildLink.ps1
TFS_UpdateWorkItemsWithBuildLink.ps1
# Adds build link to associate work items # Runs as the last step in build definitions # Encrypted password passed via build definition param( [string]$passwd ) Function UpdateWorkItemsWithBuildLink { $user = "" $secpasswd = ConvertTo-SecureString $passwd -AsPlainText -Force $cr...
PowerShellCorpus/Github/MarcusFelling_PowerShell/GAC_RegisterAssemblies.ps1
GAC_RegisterAssemblies.ps1
# List of assmemblies to be GAC'd $assemblyDll = @('example.dll') # method for adding new assemblies to the GAC function Add-GacItem([string]$file) { Begin { # see if the Enterprise Services Namespace is registered if ($null -eq ([AppDomain]::CurrentDomain.GetAssemblies() |? { $_.FullNa...
PowerShellCorpus/Github/MarcusFelling_PowerShell/TFS_CreateBranchPolicies.ps1
TFS_CreateBranchPolicies.ps1
<# .SYNOPSIS Uses the TFS REST API to apply branch policies to specified branch .DESCRIPTION This script uses the TFS REST API for configurations to set branch policies for: -approver group -Minimum approvers (2) -Required build -Work Item required .NOTES -Branch is set via build...
PowerShellCorpus/Github/MarcusFelling_PowerShell/TFS_GetCommitAssociatedToBuild.ps1
TFS_GetCommitAssociatedToBuild.ps1
<# .Synopsis Script gets commit from last successful build. .Notes TFS REST API documentation: https://www.visualstudio.com/integrate/api/build/builds #> function GetCommitAssociatedToBuild{ Param( [string]$DefinitionID = # Build Definition ID (found on variables tab) ) ...
PowerShellCorpus/Github/MarcusFelling_PowerShell/TFS_AggregateCodeCoverageResults.ps1
TFS_AggregateCodeCoverageResults.ps1
# Script to aggregate TFS 2015 build code coverage results for specified build definition # SSRS reports do not work with new build system (Non XAML) to provide this info as of Update 2 # Encrypted password passed via build definition variable param( [string]$passwd ) Function AggregateCodeCoverageResults ...
PowerShellCorpus/Github/it-praktyk_Clear-Place/Clear-Place.ps1
Clear-Place.ps1
Clear-Place { <# .SYNOPSIS Permanently delete items from given places in the room .DESCRIPTION Function intended for permanently delete items from given places in the room in the process of place cleaning. .PARAM Room The area where there are places to clean. .PARAM Place Places to be cleaned. .PARAM St...
PowerShellCorpus/Github/twgeolo_Muse/MUSEWebApp/packages/Microsoft.AspNet.Providers.LocalDB.1.1/tools/Install.ps1
Install.ps1
param($installPath, $toolsPath, $package, $project) try { # Set up variables $timestamp = (Get-Date).ToString('yyyyMMddHHmmss') $projectName = [IO.Path]::GetFileName($project.ProjectName.Trim([IO.PATH]::DirectorySeparatorChar, [IO.PATH]::AltDirectorySeparatorChar)) $catalogName = "aspnet-$project...
PowerShellCorpus/Github/twgeolo_Muse/MUSEWebApp/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/twgeolo_Muse/MUSEWebApp/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/twgeolo_Muse/MUSEWebApp/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/twgeolo_Muse/MUSEWebApp/packages/EntityFramework.5.0.0/tools/init.ps1
init.ps1
param($installPath, $toolsPath, $package, $project) $importedModule = Get-Module | ?{ $_.Name -eq 'EntityFramework' } if ($PSVersionTable.PSVersion -ge (New-Object Version @( 3, 0 ))) { $thisModuleManifest = 'EntityFramework.PS3.psd1' } else { $thisModuleManifest = 'EntityFramework.psd1' } $thisModule...
PowerShellCorpus/Github/twgeolo_Muse/MUSEWebApp/packages/EntityFramework.5.0.0/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) function Invoke-ConnectionFactoryConfigurator($assemblyPath, $project) { $appDomain = [AppDomain]::CreateDomain( 'EntityFramework.PowerShell', $null, (New-Object System.AppDomainSetup -Property @{ ShadowCopyFiles = 'true' })) ...
PowerShellCorpus/Github/twgeolo_Muse/MUSEWebApp/packages/jQuery.UI.Combined.1.8.24/Tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # Update the _references.js file Remove-Reference $scriptsFolderProjectItem $juiFileNameRegEx
PowerShellCorpus/Github/twgeolo_Muse/MUSEWebApp/packages/jQuery.UI.Combined.1.8.24/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 $juiFileNameRegEx ...
PowerShellCorpus/Github/twgeolo_Muse/MUSEWebApp/packages/jQuery.UI.Combined.1.8.24/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/twgeolo_Muse/MUSEWebApp/packages/jQuery.1.8.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/twgeolo_Muse/MUSEWebApp/packages/jQuery.1.8.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/twgeolo_Muse/MUSEWebApp/packages/jQuery.1.8.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/jsntcy_RepoDependent1/.openpublishing.build.ps1
.openpublishing.build.ps1
param( [string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.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 ur...
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_Provision_2017_4_22_24_6_19/.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/v-peliao_AAA1/.openpublishing.build.ps1
.openpublishing.build.ps1
param( [string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.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 u...
PowerShellCorpus/Github/256QAM_PowerShell-Send-Email/Send-Email.ps1
Send-Email.ps1
function Send-Email { [CmdletBinding(DefaultParametersetName='None')] param( [Alias("T")] [Parameter(Mandatory=$true)] [string[]]$ToAddress, [Alias("F")] [Parameter(Mandatory=$true)] [string]$FromAddress, [Alias("S")] [Parameter(Mandatory=$false)] [string]$Subject=' ', [Alias("B")] ...
PowerShellCorpus/Github/GertaLeStrange_test2/docker_entrypoint.ps1
docker_entrypoint.ps1
[cmdletbinding()] param() function Get-FromEnv { [cmdletbinding()] param( [parameter(Mandatory)] $Name, [parameter(Mandatory)] $Default ) $envValue = Get-ChildItem -Path Env: | Where-Object { $_.Name.ToUpper() -eq $Name.ToUpper() } | ...
PowerShellCorpus/Github/GertaLeStrange_test2/psake.ps1
psake.ps1
properties { $projectRoot = $ENV:BHProjectPath if(-not $projectRoot) { $projectRoot = $PSScriptRoot } $sut = $env:BHModulePath $tests = "$projectRoot\Tests" $outputDir = Join-Path -Path $projectRoot -ChildPath 'out' $outputModDir = Join-Path -Path $outputDir -ChildPath $env...
PowerShellCorpus/Github/GertaLeStrange_test2/build.ps1
build.ps1
[cmdletbinding(DefaultParameterSetName = 'task')] param( [parameter(ParameterSetName = 'task')] [string[]]$Task = 'default', [parameter(ParameterSetName = 'help')] [switch]$Help, [switch]$UpdateModules ) function Resolve-Module { [Cmdletbinding()] param ( [Paramete...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Implementations/Slack/SlackMessage.ps1
SlackMessage.ps1
enum SlackMessageType { Normal Error Warning } class SlackMessage : Message { [SlackMessageType]$MessageType = [SlackMessageType]::Normal SlackMessage( [string]$To, [string]$From, [string]$Body = [string]::Empty ) { $this.To = $To $this....
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Implementations/Slack/SlackPerson.ps1
SlackPerson.ps1
class SlackPerson : Person { [string]$Email [string]$Phone [string]$Skype [bool]$IsBot [bool]$IsAdmin [bool]$IsOwner [bool]$IsPrimaryOwner [bool]$IsRestricted [bool]$IsUltraRestricted [string]$Status [string]$TimeZoneLabel [string]$TimeZone [string]$Pre...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Implementations/Slack/SlackChannel.ps1
SlackChannel.ps1
class SlackChannel : Room { [datetime]$Created [string]$Creator [bool]$IsArchived [bool]$IsGeneral [int]$MemberCount [string]$Purpose }
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Implementations/Slack/SlackBackend.ps1
SlackBackend.ps1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Scope='Class', Target='*')] class SlackBackend : Backend { # The types of message that we care about from Slack # All othere will be ignored [string[]]$MessageTypes = @('channel_rename', 'message...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Implementations/Slack/SlackConnection.ps1
SlackConnection.ps1
class SlackConnection : Connection { [System.Net.WebSockets.ClientWebSocket]$WebSocket #[System.Threading.CancellationTokenSource]$CTS [pscustomobject]$LoginData [string]$UserName [string]$Domain [string]$WebSocketUrl [bool]$Connected SlackConnection() { $this.We...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Private/Copy-Object.ps1
Copy-Object.ps1
function Copy-Object { # http://stackoverflow.com/questions/7468707/deep-copy-a-dictionary-hashtable-in-powershell [outputtype([system.object])] [cmdletbinding()] param( [Parameter(Mandatory, ValueFromPipeline)] [object[]]$InputObject ) begin { $memStream = New...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Private/ConvertFrom-ParameterToken.ps1
ConvertFrom-ParameterToken.ps1
function ConvertFrom-ParameterToken { [cmdletbinding()] param( [parameter(Mandatory = 'true')] [string[]]$Tokens ) begin { $r = [pscustomobject]@{ Tokens = $Tokens NamedParameters = @{} PositionalParameters = (New-Object System.Coll...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Private/Get-StringToken.ps1
Get-StringToken.ps1
# https://gallery.technet.microsoft.com/Generic-PowerShell-string-e9ccfe73 function Get-StringToken { <# .Synopsis Converts a string into individual tokens. .DESCRIPTION Converts a string into tokens, with customizable behavior around delimiters and handling of qualified (quoted) stri...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/Save-PoshBotConfiguration.ps1
Save-PoshBotConfiguration.ps1
function Save-PoshBotConfiguration { <# .SYNOPSIS Saves a PoshBot configuration object to the filesystem in the form of a PowerShell data (.psd1) file. .DESCRIPTION PoshBot configurations can be stored on the filesytem in PowerShell data (.psd1) files. This function will save...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/New-PoshBotInstance.ps1
New-PoshBotInstance.ps1
function New-PoshBotInstance { <# .SYNOPSIS Creates a new instance of PoshBot .DESCRIPTION Creates a new instance of PoshBot from an existing configuration (.psd1) file or a configuration object. .PARAMETER Configuration The bot configuration object to create a new insta...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/New-PoshBotTextResponse.ps1
New-PoshBotTextResponse.ps1
function New-PoshBotTextResponse { <# .SYNOPSIS Tells PoshBot to handle the text response from a command in a special way. .DESCRIPTION Responses from PoshBot commands can be sent back to the channel they were posted from (default) or redirected to a DM channel with the calli...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/Get-PoshBotConfiguration.ps1
Get-PoshBotConfiguration.ps1
function Get-PoshBotConfiguration { <# .SYNOPSIS Gets a PoshBot configuration from a file. .DESCRIPTION PoshBot configurations can be stored on the filesytem in PowerShell data (.psd1) files. This functions will load that file and return a [BotConfiguration] object. .PAR...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/New-PoshBotScheduledTask.ps1
New-PoshBotScheduledTask.ps1
function New-PoshBotScheduledTask { <# .SYNOPSIS Creates a new scheduled task to run PoshBot in the background. .DESCRIPTION Creates a new scheduled task to run PoshBot in the background. The scheduled task will always be configured to run on startup and to not stop after any...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/Start-PoshBot.ps1
Start-PoshBot.ps1
function Start-PoshBot { <# .SYNOPSIS Starts a new instance of PoshBot interactively or in a job. .DESCRIPTION Starts a new instance of PoshBot interactively or in a job. .PARAMETER InputObject An existing PoshBot instance to start. .PARAMETER Configuration ...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/Get-PoshBot.ps1
Get-PoshBot.ps1
function Get-PoshBot { <# .SYNOPSIS Gets any currently running instances of PoshBot that are running as background jobs. .DESCRIPTION PoshBot can be run in the background with PowerShell jobs. This function returns any currently running PoshBot instances. .PARAMETER Id ...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/New-PoshBotCardResponse.ps1
New-PoshBotCardResponse.ps1
function New-PoshBotCardResponse { <# .SYNOPSIS Tells PoshBot to send a specially formatted response. .DESCRIPTION Responses from PoshBot commands can either be plain text or formatted. Returning a response with New-PoshBotRepsonse will tell PoshBot to craft a specially forma...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/New-PoshBotConfiguration.ps1
New-PoshBotConfiguration.ps1
function New-PoshBotConfiguration { <# .SYNOPSIS Creates a new PoshBot configuration object. .DESCRIPTION Creates a new PoshBot configuration object. .PARAMETER Name The name the bot instance will be known as. .PARAMETER ConfigurationDirectory The directory...
PowerShellCorpus/Github/GertaLeStrange_test2/PoshBot/Public/Stop-PoshBot.ps1
Stop-PoshBot.ps1
function Stop-Poshbot { <# .SYNOPSIS Stop a currently running PoshBot instance that is running as a background job. .DESCRIPTION PoshBot can be run in the background with PowerShell jobs. This function stops a currently running PoshBot instance. .PARAMETER Id Th...