full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/GithubGist/bill-long_10150938_raw_f0d45b8400ec957af8a58ebd8f54020abbc870e9_Fix-MailEnabled.ps1 | bill-long_10150938_raw_f0d45b8400ec957af8a58ebd8f54020abbc870e9_Fix-MailEnabled.ps1 | # Fix-MailEnabled.ps1
#
# The purpose of this script is to read an ExFolders or PFDAVAdmin
# property export of public folders, and fix the folders where the
# mail-enabled state is not consistent.
#
# The export must include the following properties:
# PR_PF_PROXY, PR_PF_PROXY_REQUIRED, DS:proxyAddresses
#
... |
PowerShellCorpus/GithubGist/rshk_a1fcde3b5c77bff3756b_raw_49540c8c06a0487675ea7e49b558cb006c01df73_create-vm.ps1 | rshk_a1fcde3b5c77bff3756b_raw_49540c8c06a0487675ea7e49b558cb006c01df73_create-vm.ps1 | # ------------------------------------------------------------
# Create Hyper-V virtual machine via PowerShell
# ------------------------------------------------------------
# Variables
$VM_NAME = "PS_TEST_VM"
$VM_MAC = "00:15:5d:11:22:01"
$VM_RAM = 256GB
$VM_CPUS = 16
$VM_DEST_PATH = "C:\ClusterStorage\Vol... |
PowerShellCorpus/GithubGist/dfch_3a6d9fb037896c0c2c41_raw_7fd9f8371359a058598279d526c093ec97b21a4d_ExternalWFStubs-Part2.ps1 | dfch_3a6d9fb037896c0c2c41_raw_7fd9f8371359a058598279d526c093ec97b21a4d_ExternalWFStubs-Part2.ps1 | # http://d-fens.ch/2013/12/05/vcac-dynamically-execute-scripts-in-externalwfstubs-workflows-with-powershell/
# Machine is the currently processed virtual machine
# Path is a default path where the scripts are located
# ScriptName is the name of the PowerShell script passed from the custom properties
# htScriptPar... |
PowerShellCorpus/GithubGist/mbrownnycnyc_6877244fdfc095625549_raw_11eb4ca858250cb0ddf86b2c8b269af478b3896c_make-achart.ps1 | mbrownnycnyc_6877244fdfc095625549_raw_11eb4ca858250cb0ddf86b2c8b269af478b3896c_make-achart.ps1 | Import-Module .\charting.psm1 -Force
# Create simple dataset
$simpleDataset = @{
"Microsoft" = 800
"Apple" = 250
"Google" = 400
"RIM" = 0
}
# Create chart and show it
New-Chart -Dataset $simpleDataset | Show-Chart
# Create ordered hashmap
$osloTemperature = [ordered]@{}
# Request... |
PowerShellCorpus/GithubGist/callemall_6123574_raw_ba3e772f12fed49821eaefd93224f119115e39fc_PowerShell%20-%20CheckAccount.ps1 | callemall_6123574_raw_ba3e772f12fed49821eaefd93224f119115e39fc_PowerShell%20-%20CheckAccount.ps1 | # ======================================================
# Programming Example on how to check account balance
# ======================================================
function CheckAccount
(
[String] $username,
[String] $pin
)
{
$URL = "http://staging-api.call-em-all.com/webservice... |
PowerShellCorpus/GithubGist/ctrlbold_04f743910541591443d4_raw_a3a44eb900cec369221c0e0459da136cb263482d_sp_help_revlogin2.ps1 | ctrlbold_04f743910541591443d4_raw_a3a44eb900cec369221c0e0459da136cb263482d_sp_help_revlogin2.ps1 | $source = "sqlserver"
$destination = "sqlcluster"
$smo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$smoext = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMOExtended")
$sourceserver = New-Object Microsoft.SqlServer.Management.Smo.Server $source
$destserver = New-O... |
PowerShellCorpus/GithubGist/cornfred_8966124_raw_43a8c40413c95891918f0082cfd45d07019609af_cryptoLocker.ps1 | cornfred_8966124_raw_43a8c40413c95891918f0082cfd45d07019609af_cryptoLocker.ps1 | # Credit due to www.reddit.com/user/Zendainc
#
# What this does:
# Finds out if CryptoLocker has infected pc's on the network by looking for a registery in the HKEY_USER hive. Maybe able to use for terminal servers too.
# If you find it:
# Go to the machine and extract the registry [HKEY_CURRENT_USER\Soft... |
PowerShellCorpus/GithubGist/dfch_d598378f8a162a9bdf5b_raw_7628c70bd519cf607dd8097ce2f803d140b2b1c2_SignalrClient.ps1 | dfch_d598378f8a162a9bdf5b_raw_7628c70bd519cf607dd8097ce2f803d140b2b1c2_SignalrClient.ps1 | $eventName = "receiveMessage";
Add-Type -Path ".\SignalRClient.dll"
$s = New-Object SignalRClient.Connection("http://localhost/", "commandhub");
$s.Start($eventName);
while($true) {
$s.TryDequeue($eventName)
Start-Sleep -seconds 1
}
# string TryDequeue(string eventName)
# string Dequeue(string eventN... |
PowerShellCorpus/GithubGist/mitchelldavis_464878813f87e7f1caab_raw_4c021e0833d3fb727838970fe27c591e3fc3cc86_Base64Conversions.ps1 | mitchelldavis_464878813f87e7f1caab_raw_4c021e0833d3fb727838970fe27c591e3fc3cc86_Base64Conversions.ps1 | function Convert-ToBase64
{
param( [Parameter(Mandatory=$true)][String]$target )
$b = [System.Text.Encoding]::UTF8.GetBytes($target)
[System.Convert]::ToBase64String($b)
}
function Convert-FromBase64
{
param( [Parameter(Mandatory=$true)][String]$target )
$b = [System.Convert]::FromBase6... |
PowerShellCorpus/GithubGist/kurukurupapa_7297327_raw_c6d8e0603f5536844bbc6b1ee0d18ac4f09d272a_OdbcCommand003.ps1 | kurukurupapa_7297327_raw_c6d8e0603f5536844bbc6b1ee0d18ac4f09d272a_OdbcCommand003.ps1 | Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$WarningPreference = "Continue"
$VerbosePreference = "Continue"
$DebugPreference = "Continue"
# ライブラリ読み込み
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Data")
#####################################################################... |
PowerShellCorpus/GithubGist/Kurt-P_6287165_raw_0cbaee627b9fa708ba2afd721b8143aeec81bae9_GropuAndSum.ps1 | Kurt-P_6287165_raw_0cbaee627b9fa708ba2afd721b8143aeec81bae9_GropuAndSum.ps1 | $gdata = $printsLogs | Group-Object -Property userId
$test = @()
$test += foreach($item in $gdata){
$item.Group | Select -Unique userId,
@{Name = 'PageTotal';Expression = {(($item.Group) | measure -Property pages -sum).Sum}}
}
|
PowerShellCorpus/GithubGist/rsalmond_10312091_raw_8e90491118820366eaa1be34e925c67346da4ec2_gistfile1.ps1 | rsalmond_10312091_raw_8e90491118820366eaa1be34e925c67346da4ec2_gistfile1.ps1 | function Test-Port{
<#
.SYNOPSIS
Tests port on computer.
.DESCRIPTION
Tests port on computer.
.PARAMETER computer
Name of server to test the port connection on.
.PARAMETER port
Port to test
.PARAMETER tcp
Use tcp port
... |
PowerShellCorpus/GithubGist/Tallmaris_10984688_raw_c624a0a82feb3bfb80098476367414707dcc4df1_Install-Puppet.ps1 | Tallmaris_10984688_raw_c624a0a82feb3bfb80098476367414707dcc4df1_Install-Puppet.ps1 | # Install Puppet
$MsiUrl = "https://downloads.puppetlabs.com/windows/puppet-3.5.1.msi"
$PuppetInstalled = $false
try {
$ErrorActionPreference = "Stop";
Get-Command puppet | Out-Null
$PuppetInstalled = $true
$PuppetVersion=&puppet "--version"
Write-Host "Puppet $PuppetVersion is installed. This proce... |
PowerShellCorpus/GithubGist/aplocher_31d9888a0cb6e634fafd_raw_d5b55e30920a1f018c23e228caffaee44ddb3df8_ClearVisualStudioExpHive.ps1 | aplocher_31d9888a0cb6e634fafd_raw_d5b55e30920a1f018c23e228caffaee44ddb3df8_ClearVisualStudioExpHive.ps1 | param (
[string]$fullName = "", # Example: "12.0Exp" is VS v12.0 (2013) hive name "Exp"
[switch]$listHives = $false,
[switch]$force = $false
)
$vsAppDataRoot = Join-Path $env:APPDATA "Microsoft\VisualStudio"
$vsRegKeyRoot = "hkcu:\Software\Microsoft\VisualStudio"
if (-not $fullName -and -not $listHives) {
Write-W... |
PowerShellCorpus/GithubGist/PaulDMurphy_b1efce81d31b70b135a1_raw_15fcbebb7536a4b7b46c4b5390c45c50da8e35ad_bootstrap.ps1 | PaulDMurphy_b1efce81d31b70b135a1_raw_15fcbebb7536a4b7b46c4b5390c45c50da8e35ad_bootstrap.ps1 | # Boxstarter options
$Boxstarter.RebootOk =$true # Allow reboots?
$Boxstarter.AutoLogin =$true # Save my password securely and auto-login after a reboot
$Boxstarter.NoPassword =$false # Is this a machine with no login password?
# Set the execution policy
Update-ExecutionPolicy Unrestricted
# Configure Wi... |
PowerShellCorpus/GithubGist/toddb_1138132_raw_29219b1f0ed5befb90134e3d724089b5983719f2_db-setup.psake.ps1 | toddb_1138132_raw_29219b1f0ed5befb90134e3d724089b5983719f2_db-setup.psake.ps1 | Task Db-Setup -Description "Adds the current user for access to SharePoint schemas - DEV only" {
$userToAdd = Read-Host -Prompt 'User to add to Farm Admin group <DOMAIN>\<USERNAME>'
$db_env = Read-Host -Prompt 'Environment suffix of the database to setup'
Write-Host "If this script has a problem then you ... |
PowerShellCorpus/GithubGist/gravejester_0ef473ded31e06fae9e2_raw_bf05f682d6148f3e1d38140c8f6afe23b271cb18_spotify.ps1 | gravejester_0ef473ded31e06fae9e2_raw_bf05f682d6148f3e1d38140c8f6afe23b271cb18_spotify.ps1 | function Search-Spotify {
<#
.SYNOPSIS
Search Spotify.
.DESCRIPTION
This function uses the public web API of Spotify to let you query their database for information about
artists, albums, tracks and popular playlists.
.EXAMPLE
Search-Sp... |
PowerShellCorpus/GithubGist/rhysparry_1678878_raw_285c8b4073bc1b53fcfbb8118185fac41c9b55f4_Get-TotalPrivateBytes.ps1 | rhysparry_1678878_raw_285c8b4073bc1b53fcfbb8118185fac41c9b55f4_Get-TotalPrivateBytes.ps1 | function Get-TotalPrivateBytes($Name)
{
Get-Process $Name | Measure-Object -Sum -Maximum -Minimum -Average PrivateMemorySize64
}
|
PowerShellCorpus/GithubGist/thorade_04a4eaa0a4047c523112_raw_61015ee5f7b55e9f7206f873fd50d3a98f21170c_TeX_cleanup.ps1 | thorade_04a4eaa0a4047c523112_raw_61015ee5f7b55e9f7206f873fd50d3a98f21170c_TeX_cleanup.ps1 | # This Windows PowerShell script
# recursively deletes LaTeX temporary files
# from all folder below itself
# get current directory
$curDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Write-Host $curDir
# delete files
get-childitem $curDir -include *.aex, *.aux, *.auxlock, *.bcf, *.blg, *.dpth, *.i... |
PowerShellCorpus/GithubGist/MyITGuy_9708116_raw_295d83eb1153fdb9dd670b489ad4343f7d9778e0_javacpl.ps1 | MyITGuy_9708116_raw_295d83eb1153fdb9dd670b489ad4343f7d9778e0_javacpl.ps1 | <#
.SYNOPSIS
Add and remove Java Control Panel applet entries in the Windows Control Panel.
.DESCRIPTION
The JavaCPL function collects control panel applet information from the registry. It uses this information to analyze currently visible entries and their status. Based on this information entries can ... |
PowerShellCorpus/GithubGist/ned1313_3d5b87583aaff901c1bc_raw_61b6defc01c9263e3cc9d5da915aac17c59e249c_Get-VMStatistics.ps1 | ned1313_3d5b87583aaff901c1bc_raw_61b6defc01c9263e3cc9d5da915aac17c59e249c_Get-VMStatistics.ps1 | # Horizon View VM Data Collection Script
param(
#Log file location (uses current directory by default)
[string] $logfilelocation=".\",
#CSV file location (uses current directory by default)
[string] $csvfilelocation=".\",
#PoolID (leave blank for all pools)
[string] $poolID
)
#Creat... |
PowerShellCorpus/GithubGist/michaellwest_10010536_raw_43e7607ad66d7a95b594fd19b84f77c56f3ce5c7_UnusedMediaItems.ps1 | michaellwest_10010536_raw_43e7607ad66d7a95b594fd19b84f77c56f3ce5c7_UnusedMediaItems.ps1 | <#
.SYNOPSIS
Lists all media items that are not linked to other items.
.NOTES
Michael West
#>
# HasReference determines if the specified item is referenced by any other item.
function HasReference {
param(
$Item
)
$linkDb = [Sitecore.Globals]::LinkDat... |
PowerShellCorpus/GithubGist/kondratyev-nv_6906398_raw_b8a2789b4627adae0552b8413b642492b3f43adb_to-utf.ps1 | kondratyev-nv_6906398_raw_b8a2789b4627adae0552b8413b642492b3f43adb_to-utf.ps1 | [cmdletbinding()]
param(
[parameter(mandatory=$true, position=1)]
[string]$path,
[switch]$recurse,
[array]$include,
[array]$exclude,
[string]$filter
)
if( $recurse -eq $true )
{
$files = get-childitem -recurse `
-path $path `
-exclude $exclude `
-include $in... |
PowerShellCorpus/GithubGist/tricktrap_6799444_raw_5b2f57171114eaf5b621fa9b59de75424ddf03b2_vm_report.ps1 | tricktrap_6799444_raw_5b2f57171114eaf5b621fa9b59de75424ddf03b2_vm_report.ps1 | $prodvms | select -Property Name,@{Name='IPAddress';Expression={$_.Guest.IPAddress }},@{Name='OS';Expression={$_.Guest.OSFullName}},NumCpu,MemoryMB,@{Name='Disks';Expression={$_.Guest.Disks | % { $_.Path + ': ' + [Math]::Round($_.CapacityGB + $_.FreeSpaceGB, 2) }}} | out-gridview
|
PowerShellCorpus/GithubGist/peaeater_2d985fa25e575fffd2c6_raw_ef4b0fe4daf5ac3653d08cd0131e2a1298677d72_solr-dih-ingest-with-polling.ps1 | peaeater_2d985fa25e575fffd2c6_raw_ef4b0fe4daf5ac3653d08cd0131e2a1298677d72_solr-dih-ingest-with-polling.ps1 | <#
Trigger Solr update and poll for status.
- Writes events to Application Event Log; log source must already have been added
Peter Tyrrell
#>
param(
[Parameter(Mandatory=$false,Position=0)]
[string]$logsrc = "Andi Solr Update"
)
$triggerUrl = "http://localhost:8983/solr/core1/datai... |
PowerShellCorpus/GithubGist/guitarrapc_e7285c3c66e723e6d8cb_raw_a801a8d762d3219e4a3b09b1f78c2e00a7f47d20_MS14-045CheckPipeline.ps1 | guitarrapc_e7285c3c66e723e6d8cb_raw_a801a8d762d3219e4a3b09b1f78c2e00a7f47d20_MS14-045CheckPipeline.ps1 | $message = "font '{0}' found! Your environmet will trouble with MS14-045. See https://support.microsoft.com/kb/2982791"
$fontregistory = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\'
(Get-Item -Path $fontregistory).Property | % {(Get-ItemProperty -path $fontregistory).$_ | where {... |
PowerShellCorpus/GithubGist/giseongeom_5439927_raw_cbc159883022f56034da5ddc0b1bf088fa0a6b34_stacklimit-testing.ps1 | giseongeom_5439927_raw_cbc159883022f56034da5ddc0b1bf088fa0a6b34_stacklimit-testing.ps1 |
function myfunc([int]$n)
{
if ($n -gt 0) { Write-Host $n ; myfunc($n-1) }
}
|
PowerShellCorpus/GithubGist/sweeneyrobb_bdeef74630a38086e3b3_raw_110d1e37a3daaee997dbd6bcc23455859d617e0c_New-Zip.ps1 | sweeneyrobb_bdeef74630a38086e3b3_raw_110d1e37a3daaee997dbd6bcc23455859d617e0c_New-Zip.ps1 | function New-Zip ( $zipFile, $file ) {
if ($file -is [string]) {
$file = Get-Item $file
}
set-content $zipFile ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
$zipFile = Get-Item $zipFile
$zipFile.IsReadOnly = $false
$zip = (New-Object -ComObject shell.application).NameSpace($z... |
PowerShellCorpus/GithubGist/Schweinehund_7345552_raw_6457a78a3d0243f457903f69e31f7b90b3238aaa_New-Function.ps1 | Schweinehund_7345552_raw_6457a78a3d0243f457903f69e31f7b90b3238aaa_New-Function.ps1 | Function New-Function
{
<#
#>
[CmdletBinding()]
PARAM
(
[Parameter(Mandatory=$true)]
[String]
$Parameter
)
BEGIN{}
PROCESS{}
END{}
}
|
PowerShellCorpus/GithubGist/mjul_5831679_raw_1be98260875a008dcf5a69a5352b52a05f011d30_Microsoft.PowerShell_profile.ps1 | mjul_5831679_raw_1be98260875a008dcf5a69a5352b52a05f011d30_Microsoft.PowerShell_profile.ps1 | #
# Set environment variables for Visual Studio Command Prompt
# http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-command-prompt
#
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.... |
PowerShellCorpus/GithubGist/guitarrapc_ded2a6118d7582a1b5ea_raw_79babbeee38c4cc2a4f27b500dc5c7e4ac6a755d_ConfiguraionServiceSample.ps1 | guitarrapc_ded2a6118d7582a1b5ea_raw_79babbeee38c4cc2a4f27b500dc5c7e4ac6a755d_ConfiguraionServiceSample.ps1 | Configuration Service
{
Service WinRM
{
Name = "WinRM"
State = "Running"
StartupType = "Automatic"
}
Service Winmgmt
{
Name = "Winmgmt"
State = "Running"
StartupType = "Automatic"
}
}
|
PowerShellCorpus/GithubGist/atifaziz_5779884_raw_921cb3035504189b8f4555584d8690b5ddc263a7_TimeStamp-Item.ps1 | atifaziz_5779884_raw_921cb3035504189b8f4555584d8690b5ddc263a7_TimeStamp-Item.ps1 | function TimeStamp-Item
{
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true,
HelpMessage = "Specifies the path to the item to timestamp")]
[string[]]$Path,
[switch]$Force = $false
)
... |
PowerShellCorpus/GithubGist/cromwellryan_4657224_raw_ecd0ef4e434f4f185327a3325ae111896ad3b5a5_Get-Shelveset.ps1 | cromwellryan_4657224_raw_ecd0ef4e434f4f185327a3325ae111896ad3b5a5_Get-Shelveset.ps1 | [Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
[Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Common")
$script:tpcUrl "your tpc"
function Get-ShelvsetUrl {
<#
.Synopsis
Determines the url for a TFS Shelveset.
.Description
Determine the url ... |
PowerShellCorpus/GithubGist/rossnz_8519986_raw_ded0c74256f5db6547a8209ecb52dbf9c619d50a_gistfile1.ps1 | rossnz_8519986_raw_ded0c74256f5db6547a8209ecb52dbf9c619d50a_gistfile1.ps1 | Function Convert-ToUnixDate ($PSdate) {
$epoch = [timezone]::CurrentTimeZone.ToLocalTime([datetime]'1/1/1970')
(New-TimeSpan -Start $epoch -End $PSdate).TotalSeconds
}
|
PowerShellCorpus/GithubGist/timbodv_850037ec80251c58b7f8_raw_e5df9fe8d00a8bbe39aaafca01e18e1807942116_O365BulkLicenseAssignment.ps1 | timbodv_850037ec80251c58b7f8_raw_e5df9fe8d00a8bbe39aaafca01e18e1807942116_O365BulkLicenseAssignment.ps1 | # get a list of licenses and plans
Get-MsolAccountSku | foreach { Write-Output "$($_.AccountSkuId)"; foreach ($status in $_.ServiceStatus) { Write-Output $status } }
# example to modify a user
$license = New-MsolLicenseOptions -AccountSkuId "tenant:STANDARDPACK" -DisabledPlans "MCOSTANDARD,EXCHANGE_S_STANDARD"
(G... |
PowerShellCorpus/GithubGist/josheinstein_5355916_raw_9211dc870206150b242ac471ed244e0b1de43fce_Disable-TemporaryRules.ps1 | josheinstein_5355916_raw_9211dc870206150b242ac471ed244e0b1de43fce_Disable-TemporaryRules.ps1 | ##############################################################################
#.SYNOPSIS
# Scans your Outlook rules (Outlook must be running) and disables any rules
# whose name matches a specific pattern such as:
# Move Stuff (Until 4/10/2013 5:00 PM)
# Ignore Stuff (Until 4/11/2013)
#
#.DESCRIPTION
#
# To c... |
PowerShellCorpus/GithubGist/joshtransient_5984697_raw_f67285a1eee7a859068eca9a09437ace1cc16863_Find-WebPartsById.ps1 | joshtransient_5984697_raw_f67285a1eee7a859068eca9a09437ace1cc16863_Find-WebPartsById.ps1 | param([string] $webconfigpath = 'c:\path\to\web.config')
$apppath = new-object System.IO.FileInfo $webconfigpath
$binpath = [System.IO.Path]::Combine($apppath.Directory.FullName, 'bin\')
$wpClassAspNet = [System.Type]::GetType('System.Web.UI.WebControls.WebParts.WebPart, System.Web, Version=2.0.0.0, Culture=Neutra... |
PowerShellCorpus/GithubGist/techraf_68cf5d8ec6b0ae0062f4_raw_f8b07348c204919a1483d19c17a7cbb98e14567c_profile.ps1 | techraf_68cf5d8ec6b0ae0062f4_raw_f8b07348c204919a1483d19c17a7cbb98e14567c_profile.ps1 | # This is intended to be a profile for PowerShell user
# The location of the file can be displayed by using the following command:
# $profile
# Default is:
# C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# It can be edited with
# notepad $profile
# (however when creating ... |
PowerShellCorpus/GithubGist/theerikandersson_ddd1da5833e467654659_raw_f442d7a11b45200aa1ea92b8f60dd0146c7ec383_gistfile1.ps1 | theerikandersson_ddd1da5833e467654659_raw_f442d7a11b45200aa1ea92b8f60dd0146c7ec383_gistfile1.ps1 | # -------- config-parameters ------------
# db config
$userid = "{uid}"
$password = "{pwd}"
$connstring = "Data Source={server};Initial Catalog={db};User Id={0};Password={1}" -f $userid,$password
# output file config
$outpath = "{output folder}"
$filprefix = "{prefix for saved file}"
# sql config
$sql = ... |
PowerShellCorpus/GithubGist/zheref_9586910_raw_3b04db687fdf6f729d810babae140042017ee6f2_gistfile1.ps1 | zheref_9586910_raw_3b04db687fdf6f729d810babae140042017ee6f2_gistfile1.ps1 | # ==============================================================================
#
# Fervent Coder Copyright 2011 - Present - Released under the Apache 2.0 License
#
# Copyright 2007-2008 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# th... |
PowerShellCorpus/GithubGist/jbogard_4953697_raw_917870ca2c13f361bd12ff1a092cad289982a1de_DeleteAllPrivateQueues.ps1 | jbogard_4953697_raw_917870ca2c13f361bd12ff1a092cad289982a1de_DeleteAllPrivateQueues.ps1 | [Reflection.Assembly]::LoadWithPartialName("System.Messaging")
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("localhost") | % { [System.Messaging.MessageQueue]::Delete($_.Path) }
|
PowerShellCorpus/GithubGist/alienone_e193806de56416aff829_raw_698380cea68fea077ce1c74666595be2b499b133_new_get_stats.ps1 | alienone_e193806de56416aff829_raw_698380cea68fea077ce1c74666595be2b499b133_new_get_stats.ps1 | $REMOTEREGISTRY = "C:\Temp\remote-registry.csv"
$REMOTEMASTERREGISTRY = "C:\Temp\remote-master-registry.csv"
Function ParseXMLConfig{
$timestamp = $((get-date).ToString("yyyyMMddThhmmss"))
$agenthostname = $env:computername
$processtable = (gwmi win32_service|?{$_.name -like "*arc_*"})
$process_array ... |
PowerShellCorpus/GithubGist/rprouse_184f55de1e8cfe549d4b_raw_19ac1225a7ce29765dfdce77500c95c61235fc6e_ChocolateyInstall.ps1 | rprouse_184f55de1e8cfe549d4b_raw_19ac1225a7ce29765dfdce77500c95c61235fc6e_ChocolateyInstall.ps1 | #====================================================
# Setting up a new machine using BoxStarter
# 1.Install Windows 8.1 on a new machine.
# 2.Login.
# 3.Open a command prompt and enter the following:
# START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/rprouse/184f55de1e8cfe549d4b/raw/... |
PowerShellCorpus/GithubGist/chgeuer_4127323_raw_440c8f454e43da3661673147638cfba1f663436a_rename-iplusplus.ps1 | chgeuer_4127323_raw_440c8f454e43da3661673147638cfba1f663436a_rename-iplusplus.ps1 | function Rename-ItemsPrepend {
[CmdletBinding()]
param
(
[Parameter(Mandatory=$True,
ValueFromPipeline=$False,
ValueFromPipelineByPropertyName=$True,
HelpMessage='Which number should be first prefixed')]
[int]$start
)
begin {
write-verbose "Renaming files"
}
... |
PowerShellCorpus/GithubGist/mortenya_3ce1abd86b84ad3038fe_raw_46d4335f4e3f2a1681519ee593fc28912a06d66b_Parse-DHCPLog.ps1 | mortenya_3ce1abd86b84ad3038fe_raw_46d4335f4e3f2a1681519ee593fc28912a06d66b_Parse-DHCPLog.ps1 | Function Get-FileName($initialDirectory) {
Add-Type -Assembly System.windows.forms | Out-Null
$initialDirectory = "C:\"
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.InitialDirectory = $initialDirectory
$OpenFileDialog.Filter = "Log files (*.Log)| DhcpSrvLog-*... |
PowerShellCorpus/GithubGist/andreaswasita_37a0ab92353a93751e2f_raw_14c3f64297b3ec9b5c362cc74cfa03569f8d58ce_SetAzureVNETGWKey.ps1 | andreaswasita_37a0ab92353a93751e2f_raw_14c3f64297b3ec9b5c362cc74cfa03569f8d58ce_SetAzureVNETGWKey.ps1 | Set-AzureVNetGatewayKey -VNetName USVNET -LocalNetworkSiteName SEVNET -SharedKey mypresharedkeysevnet9876
Set-AzureVNetGatewayKey -VNetName SEVNET -LocalNetworkSiteName UVNET -SharedKey mypresharedkeysevnet9876 |
PowerShellCorpus/GithubGist/CSharpFan_3466695_raw_025e02ba98cdf82e399cd8e0b4950b20c5e93a66_MyAwesomeFunction.ps1 | CSharpFan_3466695_raw_025e02ba98cdf82e399cd8e0b4950b20c5e93a66_MyAwesomeFunction.ps1 | function MyAwesomeFunction
{
param
(
[string] $foo,
[string] $bar,
[switch] $someVariable
)
Write-Host "someVariable = $someVariable"
if($someVariable)
{
Write-Host $foo
}
else
{
Write-Host $bar
}
}
MyAwesomeFunctio... |
PowerShellCorpus/GithubGist/GuruAnt_5442438_raw_51d1118c3b913d8f6fcf6a18a215ef8673afacf8_PowerCLIScriptExample1.ps1 | GuruAnt_5442438_raw_51d1118c3b913d8f6fcf6a18a215ef8673afacf8_PowerCLIScriptExample1.ps1 | # Get the name of the machine from the user
$strVM = Read-Host "Please enter the VM name"
# Attempt to get a machine-object with that name, continue silently if no machine found
$objectVM = Get-VM -Name $strVM -ErrorAction SilentlyContinue
# If there is a machine found
If ($objectVM) {
# Display the machine o... |
PowerShellCorpus/GithubGist/petermreid_573da2b83ccca9f92be8_raw_e6e61f99b3b5f8a4eb5c21f59d305cafcd7d0c3d_gistfile1.ps1 | petermreid_573da2b83ccca9f92be8_raw_e6e61f99b3b5f8a4eb5c21f59d305cafcd7d0c3d_gistfile1.ps1 | "C:\Program Files (x86)\Windows Kits\8.1\bin\x64\makecert" -pe -n "CN=tenant.sharepointonline.com" -a sha1 -sky Exchange -eku 1.3.6.1.5.5.7.3.1 -ic CA.cer -iv CA.pvk -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -sv tenant.sharepointonline.com.pvk tenant.sharepointonline.com.cer
"C:\Program Files (x86)\... |
PowerShellCorpus/GithubGist/michaelherndon_11165733_raw_bcd5eed1cf384e1c35bde5418a21654209401aaa_install-cmder.ps1 | michaelherndon_11165733_raw_bcd5eed1cf384e1c35bde5418a21654209401aaa_install-cmder.ps1 | <#
The Cmder chocolatey package is a hot mess.
This is a shame, because Cmder finally brings a decent tabbed console
interface to windows.
This script wraps the install of Cmder from Chocolatey:
* installs a start menu shortcut, which can be pinned
* removes all the batch files that automatically creat... |
PowerShellCorpus/GithubGist/nobodyguy_9950375_raw_a47c28727c8646b96be87989a5c09541af0c230c_http_server.ps1 | nobodyguy_9950375_raw_a47c28727c8646b96be87989a5c09541af0c230c_http_server.ps1 | $ServerThreadCode = {
$listener = New-Object System.Net.HttpListener
$listener.Prefixes.Add('http://+:8008/')
$listener.Start()
while ($listener.IsListening) {
$context = $listener.GetContext() # blocks until request is received
$request = $context.Request
$respon... |
PowerShellCorpus/GithubGist/sidewinder12s_39e83fc5542d818bc6f0_raw_4cc96284ebee82a48117fc8f2165ba8f3d63c755_pydio-dsc.ps1 | sidewinder12s_39e83fc5542d818bc6f0_raw_4cc96284ebee82a48117fc8f2165ba8f3d63c755_pydio-dsc.ps1 | # Powershell DSC configuration script for Pydio
# Be sure to set the $timezone and $repo variables
# The $repo location requires two folders - "installers" and "pydio-files"
# installers has php.zip (the latest PHP VC11 non-threadsafe zip), phpmanager.msi (the latest PHP Manager for IIS x64) and vcredist_x86.exe (... |
PowerShellCorpus/GithubGist/RhysC_849264_raw_9cc2b1dc1385ce6ffa5586ba1db89a1feed4f585_VersionTest.ps1 | RhysC_849264_raw_9cc2b1dc1385ce6ffa5586ba1db89a1feed4f585_VersionTest.ps1 | #Version checks
#Version type
function Test-VersionIsGreaterThanOrEqualTo()
{
param ([string] $versionA, [string] $versionB)
"versionA $versionA"
"versionB $versionB"
$version1 = New-Version $versionA
$version2 = New-Version $versionb
if($version1.Major -lt $version2.Major)
{
Write-Verbose... |
PowerShellCorpus/GithubGist/sunnyone_8071456_raw_92ca9d1a45ef154baf32d6fbeae833ad42c87d89_gistfile1.ps1 | sunnyone_8071456_raw_92ca9d1a45ef154baf32d6fbeae833ad42c87d89_gistfile1.ps1 | function Get-MyService {
Get-Service | Select-Object -First 5 | Format-List
}
function Get-MyProcess {
Get-Process | Select-Object -First 5 | Format-List
}
|
PowerShellCorpus/GithubGist/pranavkm_4287384_raw_ad11570f0f3a6ff838bfd29ffb8b6484b899b52a_gistfile1.ps1 | pranavkm_4287384_raw_ad11570f0f3a6ff838bfd29ffb8b6484b899b52a_gistfile1.ps1 | function Get-ProjectFiles {
Process {
if ($_.Kind -eq "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}" -or $_.Kind -eq "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}") {
$_.ProjectItems | Get-ProjectFiles
}
else {
$_
}
}
}
function Get-ProjectFilePath {
pa... |
PowerShellCorpus/GithubGist/posaunehm_3753744_raw_c75f52409a601c092ddc4b8bc7206ee2378eeafc_gistfile1.ps1 | posaunehm_3753744_raw_c75f52409a601c092ddc4b8bc7206ee2378eeafc_gistfile1.ps1 | Get-Clipboard -Image | %{$_.Save((Get-Date -Format "MMddhhmmss") + ".bmp")}
|
PowerShellCorpus/GithubGist/seraphy_6399082_raw_835d07663590a8a612b70cb5879f37548d95cef3_ConcatTextFiles.ps1 | seraphy_6399082_raw_835d07663590a8a612b70cb5879f37548d95cef3_ConcatTextFiles.ps1 | # 第一引数として、対象となるファイルまたは親ディレクトリを指定する.
# 省略時はカレントディレクトリ以下のすべてのファイルを対象とする.
param($searchPath = $(pwd))
# 指定したフォルダ以下の全てのファイルを取得する.
# (ファイルが指定された場合はファイル自身を返す)
function GetFilesRecurse([string] $path)
{
Get-ChildItem $path -Recurse |
Where-Object -FilterScript {
# ディレクトリ以外のみ (ディレクトリのビットマスク値は... |
PowerShellCorpus/GithubGist/angel-vladov_9482676_raw_1d590ce6f456eea37503ac32aca4f28e3f0bac5c_powershell-net.ps1 | angel-vladov_9482676_raw_1d590ce6f456eea37503ac32aca4f28e3f0bac5c_powershell-net.ps1 | function Read-HtmlPage {
param ([Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)][String] $Uri)
# Invoke-WebRequest and Invoke-RestMethod can't work properly with UTF-8 Response so we need to do things this way.
[Net.HttpWebRequest]$WebRequest = [Net.WebRequest]::Create($Uri)
[Net.HttpW... |
PowerShellCorpus/GithubGist/snowe2010_8178631_raw_8fc4fc0ad0aefcdde59113c422ca45d857eb6ed5_box40.ps1 | snowe2010_8178631_raw_8fc4fc0ad0aefcdde59113c422ca45d857eb6ed5_box40.ps1 | Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst GoogleChrome
cinst javaruntime
cinst firefox
cinst ccleaner
cinst skype
cinst dropbox
cinst windirstat
cinst launchy
cinst utorrent
cinst sumatrapdf
cinst steam
cinst mousewithoutborders... |
PowerShellCorpus/GithubGist/rhysparry_1673670_raw_325fa0c6e63a28c2870f9b1a826f25c730e290d4_GetMoreMemoryThanVisualStudio.ps1 | rhysparry_1673670_raw_325fa0c6e63a28c2870f9b1a826f25c730e290d4_GetMoreMemoryThanVisualStudio.ps1 | function Get-MoreMemoryThanVisualStudio()
{
$d = (Get-Process devenv | Measure-Object -Sum PrivateMemorySize64);
Get-Process | Where-Object {$_.PrivateMemorySize64 -gt $d.Sum}
}
|
PowerShellCorpus/GithubGist/siggibjarna_0da65bd0d3f2b82d3752_raw_6001e65e02a1c31dc74cf1c72a737908434da3c8_powerssh.ps1 | siggibjarna_0da65bd0d3f2b82d3752_raw_6001e65e02a1c31dc74cf1c72a737908434da3c8_powerssh.ps1 | # Script Name: powerssh
# Version: 1.0.0 (24. June, 2014)
# Author: Sveinn Steinarsson
# Description: Use Powershell to connect to a remote server via SSH and run a shell script/command
# Prerequisite:
# plink.exe in script path (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
# Examples:
... |
PowerShellCorpus/GithubGist/pnowosie_5231580_raw_bf8d070a56f4b9a34b88a5c2029a65a93977c615_gistfile1.ps1 | pnowosie_5231580_raw_bf8d070a56f4b9a34b88a5c2029a65a93977c615_gistfile1.ps1 | # Script creates local git repository linked with bare "remote" copy in dropbox directory,
# so you gain cloud backups ater pushing changes.
# Add following function to you PS Profile (don't forget to restart the shell)
#-----------------------------------------------------------------
# Git-Init
#----------... |
PowerShellCorpus/GithubGist/lantrix_904c7703b4c66c271149_raw_59b4e7c8d55773bfd827ee6b9e1cf1f65be79908_vol_to_del.ps1 | lantrix_904c7703b4c66c271149_raw_59b4e7c8d55773bfd827ee6b9e1cf1f65be79908_vol_to_del.ps1 | #method 1
$f = New-Object Amazon.EC2.Model.Filter
$f.Name = "attachment.instance-id"
$f.Value.Add("i-a005239e")
$voltodel = Get-EC2Volume -Filters $f
#method 2
$voltodel = Get-EC2Volume -Filters @{Name="attachment.instance-id"; Value="i-a005239e"}
|
PowerShellCorpus/GithubGist/PatrickMcDonald_531c5ca15de82787d9be_raw_817ec5cb36e0640028e8f9743be1ad3275e47a15_ps-ad.ps1 | PatrickMcDonald_531c5ca15de82787d9be_raw_817ec5cb36e0640028e8f9743be1ad3275e47a15_ps-ad.ps1 | Import-Module ActiveDirectory
# List members of a group
Get-ADGroupMember "Domain Admins" -recursive | Select-Object name
# list group memberships for user
Get-ADPrincipalGroupMembership "username" | Select-Object name
|
PowerShellCorpus/GithubGist/jonforums_5087235_raw_108177da36e54eb34656431dc59280e2fc7c36a8_build_libffi.ps1 | jonforums_5087235_raw_108177da36e54eb34656431dc59280e2fc7c36a8_build_libffi.ps1 | #requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-11 00:37:25 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add proper try-catch-finally error handling
# - support x86 and x64 builds
param(
[parameter(Mandatory=$true,
... |
PowerShellCorpus/GithubGist/pieterjd_6280119_raw_8c9cf6246088d46bf6c92b1efe853219aa461aa7_printFiles.ps1 | pieterjd_6280119_raw_8c9cf6246088d46bf6c92b1efe853219aa461aa7_printFiles.ps1 | gci -Include *.doc,*.docx -Recurse | %{Start-Process -Verb Print -FilePath $_.fullname}
|
PowerShellCorpus/GithubGist/jonforums_5167198_raw_feaa175b525c8dd28ed1e817fe94f5663a833c1a_build_minised.ps1 | jonforums_5167198_raw_feaa175b525c8dd28ed1e817fe94f5663a833c1a_build_minised.ps1 | #requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-14 23:17:01 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add proper try-catch-finally error handling
param(
[parameter(Mandatory=$true,
Position=0,
He... |
PowerShellCorpus/GithubGist/tkmtmkt_8746621_raw_0481ad6415d5596055ce1736840d1fa5b932b168_CreatePackageInfo.ps1 | tkmtmkt_8746621_raw_0481ad6415d5596055ce1736840d1fa5b932b168_CreatePackageInfo.ps1 | <#
.SYNOPSIS
パッケージ情報ファイルを作成します。
#>
ls -dir -r | select -skip 3 | %{
$dir = $_.fullname
$packageInfoFile = "$dir\package-info.java"
$packageName = (resolve-path $dir -rel).substring(2).replace('\','.')
if (test-path $packageInfoFile) {
$result = " "
} else {
$content =... |
PowerShellCorpus/GithubGist/smasterson_9140983_raw_c854457b10ebe7adbadbc4c5bfa16481dccf1efa_VeeamUpdateJobs.ps1 | smasterson_9140983_raw_c854457b10ebe7adbadbc4c5bfa16481dccf1efa_VeeamUpdateJobs.ps1 | <#
.SYNOPSIS
Update Veeam Backup Job Details
.DESCRIPTION
This script will adjust settings across all Veeam backup jobs.
Individual settings can be added/removed as needed.
.NOTES
Author: Shawn Masterson
Created: December 2013
Version: 1.0
REQUIREMENTS
Intended... |
PowerShellCorpus/GithubGist/dfch_d5990fdb391fe1b84b76_raw_2c45aebbff6937cc16b673ab2b94657251aed7dd_Convert-Currency.ps1 | dfch_d5990fdb391fe1b84b76_raw_2c45aebbff6937cc16b673ab2b94657251aed7dd_Convert-Currency.ps1 | # http://d-fens.ch/2014/01/07/nobrainer-powershell-currency-converter/
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string] $From
,
[Parameter(Mandatory = $true, Position = 1)]
[string] $To
,
[Parameter(Mandatory = $false, Position = 2)]
[Alias("Amount")]
[double] $Value = 1
,
[Paramet... |
PowerShellCorpus/GithubGist/jstangroome_2505593_raw_fadd181c115f6b7373118651a3106181bc840a1e_Positional.ps1 | jstangroome_2505593_raw_fadd181c115f6b7373118651a3106181bc840a1e_Positional.ps1 | function Get-Thing {
[CmdletBinding(DefaultParameterSetName='Default')]
param (
[Parameter(Mandatory=$true, ParameterSetName='Default', Position=0)]
$Default,
[Parameter(Mandatory=$true, ParameterSetName='Alternate')]
#[Parameter(Mandatory=$true, ParameterSetName='Alterna... |
PowerShellCorpus/GithubGist/ziqbalbh_7956710_raw_1723dabadf540a0e2f495766ff7b5a3e22b660ac_csv-split-trim.ps1 | ziqbalbh_7956710_raw_1723dabadf540a0e2f495766ff7b5a3e22b660ac_csv-split-trim.ps1 | $CSVData = @("One , Two , Three ")
#just split
$Data = $CSVData -split (",")
#first way of split and trim
$Data = $CSVData -split ',' | foreach {$_.Trim()}
#second way of split and trim
$CSVData.Split(",").Trim()
#third way of split and trim using regular expression
$Data = $CSVData -split ... |
PowerShellCorpus/GithubGist/kylesonaty_b35412907cca45754d8a_raw_5fe869b3532afc26198ef1eb263ccd3879fc8e79_gistfile1.ps1 | kylesonaty_b35412907cca45754d8a_raw_5fe869b3532afc26198ef1eb263ccd3879fc8e79_gistfile1.ps1 | param (
[string]$subscription = "Pay-As-You-Go",
[string]$service = $(throw "-service is required."),
[string]$storage = $(throw "-storage is required."),
[string]$slot = "staging", #staging or production
[string]$projectName = $(throw, "-projectName is required."),
[string]$buildConfig = ... |
PowerShellCorpus/GithubGist/CrawdadWarden_7560f0cfc3ff187a05cb_raw_9d17d2056a19c8b674d43dc6f5e13f9448e3850f_barnsley.ps1 | CrawdadWarden_7560f0cfc3ff187a05cb_raw_9d17d2056a19c8b674d43dc6f5e13f9448e3850f_barnsley.ps1 | [reflection.assembly]::LoadWithPartialName( "System.Windows.Forms")
[reflection.assembly]::LoadWithPartialName( "System.Drawing")
$form = New-Object Windows.Forms.Form
$Form.Width = 400
$Form.Height = 300
$formGraphics = $form.createGraphics()
function draw($x,$y,$color){
if($x -le $Form.Width -and $y -le $For... |
PowerShellCorpus/GithubGist/xinmyname_11375560_raw_aa3b9789e7f1153748cb5550ad0acd0e064d956a_serveandwatch.ps1 | xinmyname_11375560_raw_aa3b9789e7f1153748cb5550ad0acd0e064d956a_serveandwatch.ps1 | Start-Process python.exe -argument '-m http.server'; Start-Process livereloadx.cmd
|
PowerShellCorpus/GithubGist/jschell_a13459151dd40111ff6b_raw_6f250b711a261f6f674d7aeb69319da1e7451e59_connect-azurePSSession.ps1 | jschell_a13459151dd40111ff6b_raw_6f250b711a261f6f674d7aeb69319da1e7451e59_connect-azurePSSession.ps1 | function connect-azurePSSession
{
<#
borrowed from : http://jrich523.wordpress.com/2010/07/21/update-creating-a-profile-for-a-remote-session/
#>
[cmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$hostName,
[Parameter(Mandatory=$True)]
[int]$portNumber,... |
PowerShellCorpus/GithubGist/andrewgunn_5668952_raw_47c9faad6d9081503a7b72b8577d70e31b403167_Chocolatey.ps1 | andrewgunn_5668952_raw_47c9faad6d9081503a7b72b8577d70e31b403167_Chocolatey.ps1 | # - Install .NET Framework 4.0
# - Install Powershell 2.0
# - Open Powershell as administrator
# - Set-ExecutionPolicy RemoteSigned -Force
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Browsers
choco install Firefox
choco install GoogleChrome
choco install Opera
choco ins... |
PowerShellCorpus/GithubGist/HostileCoding_a62ca4ad2e2534d6e7f6_raw_653465d1553b4adfffc4b0756a0eae29c5456925_Tenants%20Mobile%20Reports.ps1 | HostileCoding_a62ca4ad2e2534d6e7f6_raw_653465d1553b4adfffc4b0756a0eae29c5456925_Tenants%20Mobile%20Reports.ps1 | #Variable declaration
$vCloudIPorFQDN="192.168.243.50"
$vCloudUsername="User1"
$vCloudPassword="mypassword"
$vCloudOrganization="HostileCoding"
$outputFile="C:\Users\Paolo\Desktop\mobilereport.html"
#Connecting to vCloud
Connect-CIServer -Server $vCloudIPorFQDN -User $vCloudUsername -Password $vCloudPass... |
PowerShellCorpus/GithubGist/tekk555_6249941_raw_5b9106c8f4ea44ab8ea6d59ac822179073827033_gistfile1.ps1 | tekk555_6249941_raw_5b9106c8f4ea44ab8ea6d59ac822179073827033_gistfile1.ps1 | $ runlevel
N 2
# 0 停止
# 1 シングルユーザモード
# 2 マルチユーザモード
# 6 リブート
# Ubuntu 12.04 LTS. Debian 系 OS では、2-5を区別しない。
|
PowerShellCorpus/GithubGist/qiwihui_307a3cba8097085db347_raw_0590f97a6f0147e19be4489ae96a10e9a193108c_launchIE.ps1 | qiwihui_307a3cba8097085db347_raw_0590f97a6f0147e19be4489ae96a10e9a193108c_launchIE.ps1 | $url = "http://domain/default.html"
# Attach to the existing IE window
$app = new-object -com shell.application
# get a list of all IE windows, filter to the one you need by matching its LocationURL
$ie = $app.windows() | where {$_.Type -eq "HTML Document" -and $_.LocationURL -match $url}
# if there no IE... |
PowerShellCorpus/GithubGist/guitarrapc_c75b35bb51747f2aac44_raw_3fff684a1c575fd74d41fec3d186fd1a615dbd29_PScustomObject.ps1 | guitarrapc_c75b35bb51747f2aac44_raw_3fff684a1c575fd74d41fec3d186fd1a615dbd29_PScustomObject.ps1 | ([PScustomObject]@{hoge = "hoge"}).Count # Allways null
([PScustomObject]@{hoge = "hoge"}).Length # Allways null
@([PScustomObject]@{hoge = "hoge"}).Count # 1 => Boxing with Array then get Count
@([PScustomObject]@{hoge = "hoge"}).Length # 1 => Boxing with Array then get Legnth
|
PowerShellCorpus/GithubGist/l9l6_3782585_raw_7e68222d64a2db85de645e41a5fe4792f4575d15_Powershell_AllSitesReport.ps1 | l9l6_3782585_raw_7e68222d64a2db85de645e41a5fe4792f4575d15_Powershell_AllSitesReport.ps1 | ######################## Start Variables ########################
######################## Varun's Script######################
#$siteURL = "http://sp2010citi.caceis.biz/"
#$siteURL = "http://sp-applidoc.caceis.biz/"
#$siteURL = "http://sp-collaborative.lux.caceis.biz/"
#$siteURL = "http://sp-collaboratif.cac... |
PowerShellCorpus/GithubGist/andreaswasita_c21e652fb5c1ab54bfeb_raw_7567aaff146aba8865d107f565901d2b12c751f0_CreateILBInstance.ps1 | andreaswasita_c21e652fb5c1ab54bfeb_raw_7567aaff146aba8865d107f565901d2b12c751f0_CreateILBInstance.ps1 | $svc="AZSEDB"
$ilb="SQLILB"
$subnet="Azure-BackEnd"
$IP="10.0.1.100"
Add-AzureInternalLoadBalancer -ServiceName $svc -InternalLoadBalancerName $ilb –SubnetName $subnet –StaticVNetIPAddress $IP |
PowerShellCorpus/GithubGist/wpsmith_6a96d808f2c72896e05b_raw_7abc84597001f693419a237baf2993ce0813bcfc_host-named-sites.ps1 | wpsmith_6a96d808f2c72896e05b_raw_7abc84597001f693419a237baf2993ce0813bcfc_host-named-sites.ps1 | # Replace:
# DATABASE
# NAMED
# APPLICATION NAME
# hostheadername
# DOMAIN\USER
# DOMAIN\SP_FARM_ACCOUNT
# PATHNAME
# SITE COLLECTION NAME
# DIRECTORYPORT
# Create Authentication Provider
$ap = New-SPAuthenticationProvider
# Create Web Application
$w = New-SPWebApplication -DatabaseNa... |
PowerShellCorpus/GithubGist/senpost_4628251_raw_b159757d558e7fbc2c5a9b398604646dd5ab7084_gistfile1.ps1 | senpost_4628251_raw_b159757d558e7fbc2c5a9b398604646dd5ab7084_gistfile1.ps1 | #List all files and hidden files
Get-ChildItem -Attributes !Directory+Hidden
|
PowerShellCorpus/GithubGist/sneal_73a0a088c55fbbe07ec6_raw_c7ae5356fd55a3de4fc937b55f79f839d511cefe_install-7zip.ps1 | sneal_73a0a088c55fbbe07ec6_raw_c7ae5356fd55a3de4fc937b55f79f839d511cefe_install-7zip.ps1 | $version = '922'
$msi_file_name = "7z$version-x64.msi"
$download_url = "http://downloads.sourceforge.net/sevenzip/$msi_file_name"
(New-Object System.Net.WebClient).DownloadFile($download_url, "C:\Windows\Temp\$msi_file_name")
&msiexec /i "C:\Windows\Temp\$msi_file_name" INSTALLDIR='C:\7-zip' /qb
|
PowerShellCorpus/GithubGist/guitarrapc_42679ad7bff50da42055_raw_5c89051674b505f118a2e22243d95465ee758c00_Copy-ItemEX.ps1 | guitarrapc_42679ad7bff50da42055_raw_5c89051674b505f118a2e22243d95465ee758c00_Copy-ItemEX.ps1 | function Copy-ItemEX
{
[CmdletBinding()]
param
(
[parameter(Mandatory = 1, Position = 0, ValueFromPipeline = 1, ValueFromPipelineByPropertyName =1)]
[alias('PSParentPath')]
[string]$Path,
[parameter(Mandatory = 1, Position = 1, ValueFromPipelineByPropertyName =1)]... |
PowerShellCorpus/GithubGist/andrewabest_8776157_raw_9c5c0c13928c7531658f99220e81011491b4a9a4_Deploy.ps1 | andrewabest_8776157_raw_9c5c0c13928c7531658f99220e81011491b4a9a4_Deploy.ps1 | Write-Host 'Copy the package payload over to the clickonce web application location'
$source = ".\"
$dest = "C:\Octopus\Applications\${OctopusEnvironmentName}\NextGen.ClickOnce\${OctopusPackageVersion}\Package"
$exclude = @('*.pdb','mage.exe', '*.ps1', '*Build*', '*.pfx')
$appManifestName = "${OctopusPackageName}.exe... |
PowerShellCorpus/GithubGist/kouphax_1101809_raw_f480c576ca630f712d45c18abef7a38c0dbc3e0e_Install.ps1 | kouphax_1101809_raw_f480c576ca630f712d45c18abef7a38c0dbc3e0e_Install.ps1 | Install-Package Tinyweb
|
PowerShellCorpus/GithubGist/jschell_9166802_raw_20471b66b0bd05aa41c356749ff68516cddaa4d4_azureBuildDC.ps1 | jschell_9166802_raw_20471b66b0bd05aa41c356749ff68516cddaa4d4_azureBuildDC.ps1 | ## Create New VMs
### Get image names
$serviceName = "jws-dev"
$storage = "jwsdevstor"
$networkName = "jws-network01"
$img2012R2Latest = @(get-azureVMImage | where {$_.ImageName -match "Windows-Server-2012-R2"})[-1].ImageName
$img2012Latest = @(get-azureVMImage | where {$_.ImageName -match "Windows-Server-201... |
PowerShellCorpus/GithubGist/originalmind_7636510_raw_cc8e9b0dc7443ee02db07cde8105c71919f60f76_set-path-portablegit.ps1 | originalmind_7636510_raw_cc8e9b0dc7443ee02db07cde8105c71919f60f76_set-path-portablegit.ps1 | # Usage: Call this script from your PowerShell profile:
# & c:\path\to\scripts\set-path-portablegit.ps1
# todo: set GITHUB_ROOT from registry
Set-Variable -Option Constant -Name GITHUB_ROOT -Value ${Env:USERPROFILE}\AppData\Local\GitHub\
# Get the most recently created version of PortableGit
if (!(Test-Path ... |
PowerShellCorpus/GithubGist/sukottosan_9671646_raw_3b1b64b1b9fa69ac0990d351f23712e9bf58f696_adcreation.ps1 | sukottosan_9671646_raw_3b1b64b1b9fa69ac0990d351f23712e9bf58f696_adcreation.ps1 | Install-WindowsFeature -Name AD-Domain-Services,RSAT-ADDS-Tools
Install-ADDSForest -DomainMode Win2012R2 -DomainName "lab.lab.com" -DomainNetbiosName "LAB" -ForestMode Win2012R2 -DatabasePath "C:\Windows\NTDS" -InstallDns:$true -LogPath "C:\Windows\NTDS" -NoRebootOnCompletion:$false -SysvolPath "C:\Windows\SYSVOL" -Fo... |
PowerShellCorpus/GithubGist/rheid_a5ffa6a648f07453039d_raw_986aa8559355924e757d3cac5b3abfda30d09467_updateListNoEvents.ps1 | rheid_a5ffa6a648f07453039d_raw_986aa8559355924e757d3cac5b3abfda30d09467_updateListNoEvents.ps1 | # open web
$web = Get-SPWeb http://yoursite
# get list
$list = $web.Lists["Your List"]
# get item
$item = $list.GetItemById(1)
# disable event firing
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.GetType("Microsoft.SharePoint.SPEventManager");
$prop = $type.Get... |
PowerShellCorpus/GithubGist/rysstad_10616903_raw_c7e78a6de43b38c9345dffecfe96f89406a19232_Add-Printer.ps1 | rysstad_10616903_raw_c7e78a6de43b38c9345dffecfe96f89406a19232_Add-Printer.ps1 | $PrinterPath = "\\printerServer\printerShare"
$PrinterName = "PrinterName"
$wmiNet = new-Object -com WScript.Network
$wmiNet.AddWindowsPrinterConnection($PrinterPath)
# Set as default
(New-Object -ComObject WScript.Network).SetDefaultPrinter($PrinterName)
# List all printers
# (New-Object -ComObject WSc... |
PowerShellCorpus/GithubGist/PaulStovell_5159690_raw_6f756fd0300de02a4506e5ae6f3919c32537c85d_DeployToAzure.ps1 | PaulStovell_5159690_raw_6f756fd0300de02a4506e5ae6f3919c32537c85d_DeployToAzure.ps1 | ## Octopus Azure deployment script, version 1.0
## --------------------------------------------------------------------------------------
##
## This script is used to control how we deploy packages to Windows Azure.
##
## When the script is run, the correct Azure subscription will ALREADY be selected,
## and we'... |
PowerShellCorpus/GithubGist/tophatsteve_2888674_raw_52e839f054ea533486407c718c291c2c144e4ef0_classfactory.ps1 | tophatsteve_2888674_raw_52e839f054ea533486407c718c291c2c144e4ef0_classfactory.ps1 | function ClassFactory(){
$object = New-Module {
$myField = 5
function xTimesMyField($x) {
$x * $myField
}
Export-ModuleMember -Variable * -Function *
} -asCustomObject
return $object
}
# create object
$obj = ClassFactory
# add method to object
Add-Member -InputObject $obj -MemberType Scri... |
PowerShellCorpus/GithubGist/mwrock_5422968_raw_2a29648403ffbf07bcc7ce13fdcee078d43547ec_gistfile1.ps1 | mwrock_5422968_raw_2a29648403ffbf07bcc7ce13fdcee078d43547ec_gistfile1.ps1 | Import-Module "${env:ProgramFiles(x86)}\Microsoft Team Foundation Server 2012 Power Tools\Microsoft.TeamFoundation.PowerTools.PowerShell.dll"
|
PowerShellCorpus/GithubGist/bgallagh3r_3535837_raw_0ccf27cc76cb785d2682330a152824b70eac92c3_ssh-agent-utils.ps1 | bgallagh3r_3535837_raw_0ccf27cc76cb785d2682330a152824b70eac92c3_ssh-agent-utils.ps1 | # SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy... |
PowerShellCorpus/GithubGist/theagreeablecow_6171487_raw_4361906bc445705430ded742c04b0fc262f9b629_set-ADPhotos.ps1 | theagreeablecow_6171487_raw_4361906bc445705430ded742c04b0fc262f9b629_set-ADPhotos.ps1 | <#
.SYNOPSIS
Import photos into Active Directory
.DESCRIPTION
- Source files are collected in bulk from network location and filtered on Last Modified Date
- Source files must be in the format username.jpg and will be checked against valid AD users
- The files are copied and processed in a temporary... |
PowerShellCorpus/GithubGist/belotn_6509348_raw_1d2e153ec18e9601311cb3462301600341d0ccbc_get-xaserverrole.ps1 | belotn_6509348_raw_1d2e153ec18e9601311cb3462301600341d0ccbc_get-xaserverrole.ps1 | $Branch='LocalMachine'
$SubBranch="SOFTWARE\Wow6432Node\Citrix\IMA\RUNTIME"
get-xaserver | select ServerNAme,@{N="Session-Only";E={
$registry=[microsoft.win32.registrykey]::OpenRemoteBaseKey($branch,$_.servername)
$registrykey=$registry.OpenSubKey($Subbranch)
@{$true="Controller";$false="Worker"}[$regi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.