full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/GithubGist/Elindalyne_1878488_raw_240aa6a875ecd145dd0dd7e7ba7a6376b1091a44_Bootstrap-EC2-Windows-CloudInit.ps1 | Elindalyne_1878488_raw_240aa6a875ecd145dd0dd7e7ba7a6376b1091a44_Bootstrap-EC2-Windows-CloudInit.ps1 | # Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the insta... |
PowerShellCorpus/GithubGist/DamianZaremba_d3905de95f6571d4f196_raw_16de971ef6d214c6bd55e2453958b0242996c1de_setup_mssql.ps1 | DamianZaremba_d3905de95f6571d4f196_raw_16de971ef6d214c6bd55e2453958b0242996c1de_setup_mssql.ps1 | $ErrorActionPreference = "Stop"
$client = new-object System.Net.WebClient
# Reset vagrant password so it's not expired
([adsi]"WinNT://vagrant-2012-r2/vagrant").SetPassword("P@55w0rd!")
# Setup UAC wrapper ;(
if(!(Test-Path -Path "C:\uacts_x64.zip")) {
Write-Output "Setting up UAC wrapper"
$client.Downl... |
PowerShellCorpus/GithubGist/wschwarz_5073004_raw_eeb6557fb79e8c39e49715826c418ba1fafbf705_xslt-transform.ps1 | wschwarz_5073004_raw_eeb6557fb79e8c39e49715826c418ba1fafbf705_xslt-transform.ps1 | function process-XSLT
{param([string]$a)
$xsl = "C:\path_to_xslt\CleanUp.xslt"
$inputstream = new-object System.IO.MemoryStream
$xmlvar = new-object System.IO.StreamWriter($inputstream)
$xmlvar.Write("$a")
$xmlvar.Flush()
$inputstream.position = 0
$xml = new-object System.Xml.XmlTextReader($inputstream)
$out... |
PowerShellCorpus/GithubGist/fearthecowboy_c214e02ae59f9b3fbede_raw_ff712075b7eeea5368edec7ee20aa118601e40f5_associate-powershell.ps1 | fearthecowboy_c214e02ae59f9b3fbede_raw_ff712075b7eeea5368edec7ee20aa118601e40f5_associate-powershell.ps1 | #==============================================================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... |
PowerShellCorpus/GithubGist/scott-kloud_d42dc0d6d0d32534bea4_raw_df082cafbbe82828d93ef11513d842a8c6b5ae4e_Migrate-AzureVM.ps1 | scott-kloud_d42dc0d6d0d32534bea4_raw_df082cafbbe82828d93ef11513d842a8c6b5ae4e_Migrate-AzureVM.ps1 | <#
.SYNOPSIS
Migrates a Azure Virtual Machine to another subscription or data centre
.DESCRIPTION
Shutsdown the source VM
Exports the VM config to a temporary file
Loops through all Azure disks attached to the source VM
Schedules an async copy of the underlying VHD to the destination sto... |
PowerShellCorpus/GithubGist/kyam_9972571_raw_05cd9403b70a5fc03a425f82280174ccc8253766_gistfile1.ps1 | kyam_9972571_raw_05cd9403b70a5fc03a425f82280174ccc8253766_gistfile1.ps1 | #
# HKEY_CLASSES_ROOT 2147483648
# HKEY_CURRENT_USER 2147483649
# HKEY_LOCAL_MACHINE 2147483650
# HKEY_USERS 2147483651
# HKEY_CURRENT_CONFIG 2147483653
# HKEY_DYN_DATA 2147483654
#
#
$loc = Get-Location
$dir = $loc.Path
$csvfile = $dir + "\" + $Args[0]
$outputfile = $dir + "\" + $Args... |
PowerShellCorpus/GithubGist/thorade_0808b5fd73becf3a35b6_raw_7e742e56f154513b1ec448e814ad36462d4c10f2_remove_bakmo.ps1 | thorade_0808b5fd73becf3a35b6_raw_7e742e56f154513b1ec448e814ad36462d4c10f2_remove_bakmo.ps1 | # This Windows PowerShell script
# recursively deletes Dymola *.bak-mo backup files
# from all folders below itself
# get current directory
$curDir = Split-Path -Parent $MyInvocation.MyCommand.Path
# delete files
get-childitem $curDir -include *.bak-mo -recurse | foreach ($_) {remove-item $_.fullname}
... |
PowerShellCorpus/GithubGist/willbar_9266405_raw_d0b41134e18c4a0b2e71741e9031fc724d243129_MachineSetup.ps1 | willbar_9266405_raw_d0b41134e18c4a0b2e71741e9031fc724d243129_MachineSetup.ps1 | Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst sublimetext3
cinst git
cinst git-credential-winstore
cinst poshgit
cinst NuGet.CommandLine
cinst NuGetPackageExplorer
cinst pscx
cinst ScriptCs
cinst sysinternals
cinst fiddler4
|
PowerShellCorpus/GithubGist/toddb_1133509_raw_cb725dae031784cec91843a28bd9347354896b7e_test-tasks.ps1 | toddb_1133509_raw_cb725dae031784cec91843a28bd9347354896b7e_test-tasks.ps1 | <#
Usage for Gallio tests:
Task Test-System -Description "Runs the system tests via Gallio" {
Test-Gallio $proj $configuration $platform $dll "system" "Test.System"
# Test-Gallio ".\src\Test.Unit\Test.Unit.csproj" Release x64 ".\src\Test.Unit\bin\Release\x64\Test.Unit.dll" "unit"
}
}
#>
function ... |
PowerShellCorpus/GithubGist/weipah_2506769_raw_0e386ce799a041707e330d8e5921c7efb48d9131_XADGroupCopy.ps1 | weipah_2506769_raw_0e386ce799a041707e330d8e5921c7efb48d9131_XADGroupCopy.ps1 | function XADGroupCopy() {
param(
[parameter(Mandatory=$true,Position=0,HelpMessage="Von welchem User sollen Berechtigungen kopiert werden?")]
[String]
$fromUser,
[parameter(Mandatory=$true,Position=1,HelpMessage="Welcher User erhaelt die neuen Gruppen?")]
[String]
$toUser
)
$antwort = read-host "Sind... |
PowerShellCorpus/GithubGist/jincod_03ed02181c83faf93081_raw_e8ed03a6c823f1cdf6b597d528eff62119cacc3c_changes.ps1 | jincod_03ed02181c83faf93081_raw_e8ed03a6c823f1cdf6b597d528eff62119cacc3c_changes.ps1 | $buildId = 10048
$teamcityUrl = "http://teamcity:8080"
$auth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
@((Invoke-RestMethod $teamcityUrl/httpAuth/app/rest/changes?build=id:$buildId -Headers @{"Authorization" = "Basic $auth"}).changes.change) | % { (Invoke-RestMe... |
PowerShellCorpus/GithubGist/xcud_4955455_raw_8e2e62bbbebe86311c0556ea2254f4718981299f_Get-Content.ps1 | xcud_4955455_raw_8e2e62bbbebe86311c0556ea2254f4718981299f_Get-Content.ps1 | <#
.Synopsis
Extend Get-Content to include a -Fast parameter; much less flexible but more performant
.Example
PS> (Measure-Command { Get-Content .\data.xml} ).TotalMilliseconds
1609.3267
PS> (Measure-Command { Get-Content .\data.xml -Fast} ).TotalMilliseconds
39.2511
#>
function Get-Co... |
PowerShellCorpus/GithubGist/mwjcomputing_4717642_raw_a936466520dda8f7cf58b515c4a42ddba453cf20_Get-DaysUntilBSidesDetroit.ps1 | mwjcomputing_4717642_raw_a936466520dda8f7cf58b515c4a42ddba453cf20_Get-DaysUntilBSidesDetroit.ps1 | function Get-DaysUntilBSidesDetroit {
Write-Host "There are $((New-Timespan -end '6/7/2013 9:00:00AM').Days) days until BSidesDetroit."
}
|
PowerShellCorpus/GithubGist/william-gross_77fd0fdc9e3ce03f093f_raw_8b0e6339696280f7e4563da52aa443821a10449f_hasync.ps1 | william-gross_77fd0fdc9e3ce03f093f_raw_8b0e6339696280f7e4563da52aa443821a10449f_hasync.ps1 | cd humanizer-annotations
git pull https://enduracode.kilnhg.com/Code/Ewl/ReSharperAnnotations/Humanizer.git
git push origin
|
PowerShellCorpus/GithubGist/NotMyself_e310fc01b941491fcd89_raw_e3fefeda5ef3b32064555a1e696c35b8ecb71272_gistfile1.ps1 | NotMyself_e310fc01b941491fcd89_raw_e3fefeda5ef3b32064555a1e696c35b8ecb71272_gistfile1.ps1 | task Run-Site -depends Clean, MsBuild-Release {
$iisexpress = "$env:ProgramFiles\IIS Express\iisexpress.exe"
start $iisexpress @("/port:8080 /path:$workPath\_PublishedWebsites\UIWeb")
}
|
PowerShellCorpus/GithubGist/biacz_f4ec5140d75d708d413d_raw_5f0de8b55a6d94df24ebd2f429880bae6e8ca280_gistfile1.ps1 | biacz_f4ec5140d75d708d413d_raw_5f0de8b55a6d94df24ebd2f429880bae6e8ca280_gistfile1.ps1 | # Variables, Functions and Data Collection
$DaysData = "7"
$ErrorActionPreference = "Stop"
$MyReport = @()
$Creds = Get-Credential
$HTMLHeader = @"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html><head><title>My Systems Report</title>
<s... |
PowerShellCorpus/GithubGist/desek_1edf1f404d7ec58531be_raw_033aa363143b537a64b9573931c57a4ab9bf01d1_ProcessSCSMDW.ps1 | desek_1edf1f404d7ec58531be_raw_033aa363143b537a64b9573931c57a4ab9bf01d1_ProcessSCSMDW.ps1 | $smdir = (Get-ItemProperty "HKLM:\Software\Microsoft\System Center\2010\Service Manager\Setup").InstallDirectory
Import-Module "$smdir\Microsoft.EnterpriseManagement.Warehouse.Cmdlets.psd1"
$SleepTimer = 120
$JobTypes = @(
"DWMaintenance",
"MPSyncJob",
"Extract_",
"Transform.",
"Load.",
... |
PowerShellCorpus/GithubGist/rchaganti_656fd3a8e6b6368ed5dc_raw_2f86a220c12150f4ae3e089ab3fa7f6f72763393_Get-AzureStatus.ps1 | rchaganti_656fd3a8e6b6368ed5dc_raw_2f86a220c12150f4ae3e089ab3fa7f6f72763393_Get-AzureStatus.ps1 | Function Get-AzureStatus {
$response = Invoke-RestMethod -Uri 'http://azure.microsoft.com/en-us/status/feed/'
if ($response) {
foreach ($item in $response) {
Write-Host "$($item.Title) : " -NoNewline
Write-Host -ForegroundColor Red "$($item.Description)"
}
} el... |
PowerShellCorpus/GithubGist/jeffpatton1971_354c4c0948a93ea5b9e0_raw_75d2377924c917331b17b92f8e63edce1f473782_Setup-Server.ps1 | jeffpatton1971_354c4c0948a93ea5b9e0_raw_75d2377924c917331b17b92f8e63edce1f473782_Setup-Server.ps1 | <#
This script will configure the local machine for the SQL MP
Low Privilege Environment
We need to set the following items on the server
Add SQLDefaultAction account and SQLMonitor account to
Performance Monitor Users
Add SQLDefaultAction account and SQLMonitor account to
... |
PowerShellCorpus/GithubGist/steelcm_2558512_raw_14f084721ec45e0baa90e1ff57cb0eec2aec9dc9_gistfile1.ps1 | steelcm_2558512_raw_14f084721ec45e0baa90e1ff57cb0eec2aec9dc9_gistfile1.ps1 | PS C:\> netstat -an | select-string -pattern "listening"
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 0.0.0.0:81 0.0.0.0:0 LISTENING
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:383 0.0.0.0:0 LISTENI... |
PowerShellCorpus/GithubGist/colinbowern_5937673_raw_828317b19e3d5f3e7bc26936e973e6026e47367c_Import-SQLPS.ps1 | colinbowern_5937673_raw_828317b19e3d5f3e7bc26936e973e6026e47367c_Import-SQLPS.ps1 | $CurrentFolder = $(Get-Location).Path
Import-Module SQLPS -DisableNameChecking
Set-Location $CurrentFolder
|
PowerShellCorpus/GithubGist/kmoormann_3406887_raw_9e3b225896735628626211fb4a2e4084325cdc21_CopyFilesInFolder.ps1 | kmoormann_3406887_raw_9e3b225896735628626211fb4a2e4084325cdc21_CopyFilesInFolder.ps1 | function Global:CopyFilesInFolder([string] $FromDir, [string] $ToDir, [string] $FileExtension)
{
#Destination for files
$From = $FromDir + "*" + $FileExtension
Copy-Item $From $ToDir
}
|
PowerShellCorpus/GithubGist/pcgeek86_b5f29ab8a11b414b230f_raw_0dd49062baf8ef6999e289ee3c9d7438c838f2d4_gistfile1.ps1 | pcgeek86_b5f29ab8a11b414b230f_raw_0dd49062baf8ef6999e289ee3c9d7438c838f2d4_gistfile1.ps1 | $MyFilter = New-WmiEventFilter –Name WatchFolderRoboCopy –Query 'SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA "CIM_DirectoryContainsFile" AND TargetInstance.GroupComponent = "Win32_Directory.Name=\"c:\\\\FileHistory\""' –EventNamespace "root\cimv2"
$MyConsumer = New-WmiEventConsumer –Consum... |
PowerShellCorpus/GithubGist/ykhroki_ce9ce661302c28656898_raw_cbe82c67cbd45fbbbf99866ae3a84fd0e4cb68e4_expire-homedir.ps1 | ykhroki_ce9ce661302c28656898_raw_cbe82c67cbd45fbbbf99866ae3a84fd0e4cb68e4_expire-homedir.ps1 |
# By Request: Searching files by age (and other properties) via PowerShell (#PowerShell)
# <http://www.systemcentercentral.com/by-request-searching-files-by-age-and-other-properties-via-powershell-powershell/>
# “Delete Files Older Than” Batch Script - ServerFault
# <http://serverfault.com/questions/259707/delete-... |
PowerShellCorpus/GithubGist/jtuttas_5354953_raw_42e7e9cc2cc21dace8f3316caa1a443ec6b0a49e_drehFuntion.ps1 | jtuttas_5354953_raw_42e7e9cc2cc21dace8f3316caa1a443ec6b0a49e_drehFuntion.ps1 | cls
function dreh([String]$a) {
$out=""
for ($i=$a.Length-1;$i -ge 0;$i--) {
$out=$out+$a.Chars($i)
}
return $out
}
$a=dreh ("Hallo")
Write-Host ("Gedreht ("+$a+")")
|
PowerShellCorpus/GithubGist/tkinz27_fd92ba9af0e0309614ee_raw_a7f4617532509ea872a261ad1b95d3ffe25151c4_copy.ps1 | tkinz27_fd92ba9af0e0309614ee_raw_a7f4617532509ea872a261ad1b95d3ffe25151c4_copy.ps1 | #!powershell
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribu... |
PowerShellCorpus/GithubGist/pieterjd_5465325_raw_50816aacba1df4862c6bc2675b164478c3217b4e_listInstalledUpdates.ps1 | pieterjd_5465325_raw_50816aacba1df4862c6bc2675b164478c3217b4e_listInstalledUpdates.ps1 | $Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$HistoryCount = $Searcher.GetTotalHistoryCount()
$Searcher.QueryHistory(1,$HistoryCount) | Select-Object Date, Title,ClientApplicationID ,Description | Out-GridView
$Searcher.QueryHistory(1,$HistoryCount) | Select-... |
PowerShellCorpus/GithubGist/mrxinu_4142383_raw_72888cae5fa44e09145e8e146fcafecc4bda6afd_get-macs.ps1 | mrxinu_4142383_raw_72888cae5fa44e09145e8e146fcafecc4bda6afd_get-macs.ps1 | #
# Script: get-macs.ps1
#
# Purpose: Connect to a list of servers and get their MACs and IP
# addresses and output the results.
#
# Written by Steven Klassen <sklassen@gmail.com>
#
# Usage: .\get-macs.ps1 <computer_list>
#
#############################################################################... |
PowerShellCorpus/GithubGist/bak-t_7946132_raw_feddd78abb4ca37708b80cd9f7022b172bc43c28_create-package.ps1 | bak-t_7946132_raw_feddd78abb4ca37708b80cd9f7022b172bc43c28_create-package.ps1 | $ErrorActionPreference = "Stop"
#$version = "1.0.5-alpha"
$version = "1.0.4.1-patched"
$packageSpec = "..\smartconf\SmartConf\SmartConf.nuspec"
$solutionFile = "..\smartconf\SmartConf.sln"
$projectFile = "..\smartconf\SmartConf\SmartConf.csproj"
$solutionConfiguration = "Release"
function Main() {
# inte... |
PowerShellCorpus/GithubGist/danielthor_e141a530dfa7a9636274_raw_6ffa851d8b57e9e63a8aa0b2fa2a666f72a6a399_export_from_ad.ps1 | danielthor_e141a530dfa7a9636274_raw_6ffa851d8b57e9e63a8aa0b2fa2a666f72a6a399_export_from_ad.ps1 | # Export data from AD
# Give PS access to import snapins
Set-ExecutionPolicy Unrestricted
# Add AD module
Import-Module ActiveDirectory
# Add Quest snapin for nifty commands
# Requirers install: http://www.quest.com/powershell/activeroles-server.aspx
# Manual: http://wiki.powergui.org/index.php
Add-PSSnapin... |
PowerShellCorpus/GithubGist/kyam_5577021_raw_bfcbd8863c1041b39b47f70edad230e6655be214_add-domainuser.ps1 | kyam_5577021_raw_bfcbd8863c1041b39b47f70edad230e6655be214_add-domainuser.ps1 | #
# http://gallery.technet.microsoft.com/scriptcenter/68546b6d-4fee-47e1-9635-a5378576406c
#
# \\domain\\kyam ... domain user
# \\computer1 ... computer-name
#
#
$user = [ADSI]("WinNT://domain/kyam")
$group = [ADSI]("WinNT://computer1/Administrators")
$group.PSBase.Invoke("Add",$user.PSBase.Path)
... |
PowerShellCorpus/GithubGist/rwhitmire_6033474_raw_37c61cb63a0f67910ffc3b8c70204430c6cb0d51_posh-git-setup.ps1 | rwhitmire_6033474_raw_37c61cb63a0f67910ffc3b8c70204430c6cb0d51_posh-git-setup.ps1 | Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy Bypass
# add this to profile
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"
|
PowerShellCorpus/GithubGist/joshtransient_5984597_raw_f23dbdb9ac64f17955abd4d1d039563e9a0af766_Reset-SPVersions.ps1 | joshtransient_5984597_raw_f23dbdb9ac64f17955abd4d1d039563e9a0af766_Reset-SPVersions.ps1 | ### BEGIN VARIABLES ###
$siteUrl="https://sharepoint/" #Enter the URL to your site.
$csvFile=".\sites.csv"
$useCsvFile=$false
$outPut="C:\metrics\scripts\VersionDeletionReport.xml"
$deleteVersion=$false #CAUTION!!!When set to false will only report on files that would be Deleted, else versions are deleted.
[In... |
PowerShellCorpus/GithubGist/brianvp_af04dfd4d986b8388037_raw_e1ba6df77dba3bbb37e5d0ee6c266500d35a6fbf_gistfile1.ps1 | brianvp_af04dfd4d986b8388037_raw_e1ba6df77dba3bbb37e5d0ee6c266500d35a6fbf_gistfile1.ps1 | # Initial Draft - needs cleanup
Function getInputGrid($choice)
{
#7 10 10
if ($choice -eq "DefaultInput")
{
return '..........
..........
..#.......
...#......
.###......
..........
..........
..........
..........
..........'
}
#32 17 17
elseif ($choice -eq "challenge")
{
return '........ |
PowerShellCorpus/GithubGist/kolesnick_7639633_raw_b05b0944b6a815ab07c72da7e6311ebde3edac47_hg-branchowners.ps1 | kolesnick_7639633_raw_b05b0944b6a815ab07c72da7e6311ebde3edac47_hg-branchowners.ps1 | hg branches | %{ $_.Split(' ')[0] } | group { hgbranchowner $_ } | %{
write $_.Name
$_.Group | write
write ''
}
|
PowerShellCorpus/GithubGist/ao-zkn_2e77e54bec663289a33d_raw_df43aa78d74a541aa9073ece4071970edeeb8d5e_Rotate-Daily.ps1 | ao-zkn_2e77e54bec663289a33d_raw_df43aa78d74a541aa9073ece4071970edeeb8d5e_Rotate-Daily.ps1 | # ------------------------------------------------------------------
# 日付でファイルのローテーションを行う
# 関数名:Rotate-Daily
# 引数 :FilePath ファイルパス
# :DailyRollingFormat 日付フォーマット(デフォルト:yyyy-MM-dd)
# 戻り値:なし
# ------------------------------------------------------------------
function Rotate-Daily([String]$FilePath,[String]$DailyR... |
PowerShellCorpus/GithubGist/Novakov_3675315_raw_8d8a9deef32293cdcdbfc2f4f28e46b5e1252c52_gistfile1.ps1 | Novakov_3675315_raw_8d8a9deef32293cdcdbfc2f4f28e46b5e1252c52_gistfile1.ps1 | $TOOLS = "D:\Tools"
$WIM_FILE = "C:\ISOs\install_win2008_r2_std_core.wim"
$IMG_INDEX = 1
$VHD_FILE = "C:\VHD - DA\win2008r2_offline.vhd"
$VHD_SIZE = 20480
$LETTER = "Z"
$MOUNT = "$($LETTER):"
$ANSWER_FILE = "c:\ISOs\win2008_r2_offline.xml"
$FEATURES = "NetFx2-ServerCore",
"IIS-WebServerRole",
"Microso... |
PowerShellCorpus/GithubGist/adamfisher_4317c41f4eae800b356f_raw_c880614a3a35ad66462d0b6e57f99c0779670ed7_Disable%20Windows%20Hibernation.ps1 | adamfisher_4317c41f4eae800b356f_raw_c880614a3a35ad66462d0b6e57f99c0779670ed7_Disable%20Windows%20Hibernation.ps1 | powercfg /hibernate off |
PowerShellCorpus/GithubGist/thethomaseffect_6933803_raw_a5b82b800906512cadb05ed1d7a0afbc9090534a_csharp_in_powershell.ps1 | thethomaseffect_6933803_raw_a5b82b800906512cadb05ed1d7a0afbc9090534a_csharp_in_powershell.ps1 | $Source = @"
namespace CSharpPSTest
{
public static class PSTest
{
private static string _result = "Default Value";
public static string Get()
{
return "Get Success: " + _result;
}
public static string Set(string s)
{
_result ... |
PowerShellCorpus/GithubGist/NeilHanlon_11064226_raw_80ffe34812e49c2fa91705eb779f9e18c9b4afd9_2014response.ps1 | NeilHanlon_11064226_raw_80ffe34812e49c2fa91705eb779f9e18c9b4afd9_2014response.ps1 | $list = ipcsv '.\2014respond.csv';
#$list | ForEach-Object { Write-Host ($_.LastName)($_.FirstName.Substring(0,1)) }
$process = ForEach ($user in $list)
{
$user3 = $user.LastName +""+ $user.FirstName.Substring(0,1)
try{
$user2 = Get-ADUser $user3 -Properties mail
}
catch{
... |
PowerShellCorpus/GithubGist/mst8000_cd1afed4008d3c90a155_raw_af3f627a28f14c1b411871f4e407df4bf63519fe_Calender.ps1 | mst8000_cd1afed4008d3c90a155_raw_af3f627a28f14c1b411871f4e407df4bf63519fe_Calender.ps1 | $offset = (Get-Date).AddDays(-(Get-Date).Day + 1).DayOfWeek.value__
$last = (Get-Date).AddDays(-(Get-Date).Day + 1).AddMonths(1).AddDays(-1).Day
for ($($day = -$offset + 1; $count = 1); $day -le $last ; $day++, $count++) {
if ($day -le 0) {
Write-Host -n " "
} elseif ($count % 7 -eq 0) {
... |
PowerShellCorpus/GithubGist/IISResetMe_0b8033cb7382d88208b0_raw_888232a1113bf9953c25f81c7e1dc17a0e2e8640_LazyWebclient.ps1 | IISResetMe_0b8033cb7382d88208b0_raw_888232a1113bf9953c25f81c7e1dc17a0e2e8640_LazyWebclient.ps1 | param($u)(&{if($c-is[System.Net.WebClient]){$c}else{($global:c=New-Object System.Net.WebClient)}}).DownloadString($u)
|
PowerShellCorpus/GithubGist/roberto-reale_712c70d55f3dc9d49335_raw_d70cd32997d51113c11fcddffb7a0e48fba8fc1a_rename_files_iso8601_with_progressive_id.ps1 | roberto-reale_712c70d55f3dc9d49335_raw_d70cd32997d51113c11fcddffb7a0e48fba8fc1a_rename_files_iso8601_with_progressive_id.ps1 | #
# rename a bunch of files as follows
#
# YYYY-MM-DD_NAME.EXT ==> YYYY-MM-DD_nnnn_NAME.EXT
#
# where nnnn is a progressive identifier
#
# initialize the progressive identifier
$id = 0;
# for each file in the local path
Get-ChildItem -name |% {
# old filename is in the form YYYY-MM-DD_NAME.EXT ... |
PowerShellCorpus/GithubGist/krohrbaugh_6875688_raw_7c9e1e67416817e31200c4cc003f5e6913dfe174_example.ps1 | krohrbaugh_6875688_raw_7c9e1e67416817e31200c4cc003f5e6913dfe174_example.ps1 | # Using the Windows Azure Active Directory Module for Windows PowerShell
#
# Connect to the tenant to modify
Connect-MsolService # => login
# Get Service Principal to add the role to
$servicePrincipal = Get-MsolServicePrincipal -ServicePrincipalName Principal.Name
# Get role object ID
# Alternatively, you ca... |
PowerShellCorpus/GithubGist/mvadstrup_4409388_raw_09e0a538319ba676c1895a9bd8e44da3e56f47a5_gistfile1.ps1 | mvadstrup_4409388_raw_09e0a538319ba676c1895a9bd8e44da3e56f47a5_gistfile1.ps1 | #
# Powershell script for adding/removing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
remove-h... |
PowerShellCorpus/GithubGist/wpsmith_a9d1bb00252bac22cadc_raw_7f99b5beece3446e51143135514a05edcfc74de4_flushBLOBCache.ps1 | wpsmith_a9d1bb00252bac22cadc_raw_7f99b5beece3446e51143135514a05edcfc74de4_flushBLOBCache.ps1 | Param(
[string]$webAppURL
)
#Loading SharePoint Powershell Snaping
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
if (!$webAppURL) { $webAppURL = Read-Host "What is the web application's URL?" }
Write-Host "Checking:" $webAppURL
$webApp = Get-SPWebApplication $webAppURL
[Micr... |
PowerShellCorpus/GithubGist/JonasGroeger_301db5e64afdcd90e71e_raw_e084376972e4e0bcdc030e9cacec50e85592832a_Clean-Temporary-Files.ps1 | JonasGroeger_301db5e64afdcd90e71e_raw_e084376972e4e0bcdc030e9cacec50e85592832a_Clean-Temporary-Files.ps1 | # ------------------------------------------------------------------------------
# Script: Clean-Temporary-Files.ps1
# Author: Jonas Gröger <jonas.groeger@gmail.com>
# Date: 12.04.2014
# Keywords: LaTeX, Clean, Delete, Remove, Temporary, Files
# Comments: Removes temporary files created by LaTeX etc. You can tweak... |
PowerShellCorpus/GithubGist/kyle-herzog_9532722_raw_69ab5932a4bcec8a8e009329b6bdc1e37993e945_Get-SolutionProjects.ps1 | kyle-herzog_9532722_raw_69ab5932a4bcec8a8e009329b6bdc1e37993e945_Get-SolutionProjects.ps1 | Add-Type -AssemblyName "EnvDTE"
$vsInstance = [System.Runtime.InteropServices.Marshal]::GetActiveObject("VisualStudio.DTE.11.0")
$dte = $vsInstance.DTE
$solution = $dte.Solution
$soltuion.Projects | Format-List
Write-Host "$($solution.Projects)"
$solution.Projects | Foreach-Object `
{
Write-Host "Projec... |
PowerShellCorpus/GithubGist/eltone_6979834_raw_5cd7cdc8e008d6cd5a95f8d913c6443023b4c06f_DisableNuGetPackageRestore.ps1 | eltone_6979834_raw_5cd7cdc8e008d6cd5a95f8d913c6443023b4c06f_DisableNuGetPackageRestore.ps1 | if(!(Test-Path *.sln)) {
echo ($pwd.Path + " is not a vs solution folder")
}
else {
#remove .nuget folder
Remove-Item .nuget -Recurse
#remove .nuget sln folder
Get-Item *.sln | ForEach-Object {
$c = [System.IO.File]::ReadAllText($_.Fullname)
$c -replace '(?s)Project\("\{21... |
PowerShellCorpus/GithubGist/wpsmith_eaae2a6155357107cbe4_raw_e6e7034bbae8b55f5becef27979927181d64c70a_SP.GetRunningWorkflows.ps1 | wpsmith_eaae2a6155357107cbe4_raw_e6e7034bbae8b55f5becef27979927181d64c70a_SP.GetRunningWorkflows.ps1 | Clear-Host
#Start, SP Site URL
$web = Get-SPWeb "https://myrndc.rndc-usa.com/";
$web.AllowUnsafeUpdates = $true;
#Pages List Name
$list = $web.Lists["Pages"];
$count = 0
#Loop through all Items in List then loop through all Workflows on each List Items.
foreach ($listItem in $list.Items) {
... |
PowerShellCorpus/GithubGist/pavelbinar_7397549_raw_fe50bc3b6ebc9dd2897f1ffd214aecaff6a127fc_gistfile1.ps1 | pavelbinar_7397549_raw_fe50bc3b6ebc9dd2897f1ffd214aecaff6a127fc_gistfile1.ps1 | # NPM
npm update
# Ruby gems
gem update
# Homebrew
brew upgrade
# yeoman generators
npm update -g generator-_______
|
PowerShellCorpus/GithubGist/dfinke_4161503_raw_98cf6c46de5365afa7a14275836e056c6f796504_ppm.ps1 | dfinke_4161503_raw_98cf6c46de5365afa7a14275836e056c6f796504_ppm.ps1 | param ($key)
<#
# sample package.ps1
@{
start = {1..10}
stuff = "this is stuff"
}
#>
$defaultPackageName = ".\package.ps1"
if(Test-Path $defaultPackageName) {
$package = & $defaultPackageName
if(!$key) {$key="start"}
if(!$package.ContainsKey($key)) {
Write-Er... |
PowerShellCorpus/GithubGist/jstangroome_5437665_raw_03875cb83bf59017a25fd62019042767236714b1_PSISEAliasExpansion.ps1 | jstangroome_5437665_raw_03875cb83bf59017a25fd62019042767236714b1_PSISEAliasExpansion.ps1 | function Expand-Alias {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]
$Code
)
[ref]$CodeErrors = New-Object -TypeName System.Collections.ObjectModel.Collection[System.Management.Automation.PSParseError]
$Tokens = [System.Management.Automation.PSPar... |
PowerShellCorpus/GithubGist/l1x_3642024_raw_9f4cacfb6fc5dd6b33380b986fb552b40f1905ad_GitUtils.ps1 | l1x_3642024_raw_9f4cacfb6fc5dd6b33380b986fb552b40f1905ad_GitUtils.ps1 | # Add a key to the SSH agent
function Add-SshKey() {
$sshAdd = Get-Command ssh-add -TotalCount 1 -ErrorAction SilentlyContinue
if (!$sshAdd) { Write-Warning 'Could not find ssh-add'; return }
if ($args.Count -eq 0) {
$sshPath = Resolve-Path ~/.ssh/github_rsa
& $sshAdd $sshPath
}... |
PowerShellCorpus/GithubGist/taddev_3965431_raw_2ab88b19400f4b9de014b3dfede0a13e08fd45a8_SignCode.ps1 | taddev_3965431_raw_2ab88b19400f4b9de014b3dfede0a13e08fd45a8_SignCode.ps1 | #
# Author: Tad DeVries
# Email: taddevries@gmail.com
# FileName: SignCode.ps1
#
# Description:
# Uses a codesigning certifcate in your certificate list
# to sign the code. You may need to edit the options below
# to select the correct certificate if you have more than
# one like I do.
#
#
# Copyright (C) 2... |
PowerShellCorpus/GithubGist/tkmtmkt_2490903_raw_a401aae0d6fac1bb951c5304f6a3af46b122ab08_CollectVersionInfo.ps1 | tkmtmkt_2490903_raw_a401aae0d6fac1bb951c5304f6a3af46b122ab08_CollectVersionInfo.ps1 | <#
.SYNOPSIS
ソフトウェアのバージョン情報を収集する
#>
$ps1_file = &{$myInvocation.ScriptName}
$base_dir = Split-Path (Split-Path $ps1_file)
$log_dir = "$base_dir\log"
$log_file = "$log_dir\$((Split-Path -Leaf $ps1_file).Replace(".ps1",".log"))"
if (-not (Test-Path "$log_dir")) {New-Item "$log_dir" -Force -ItemType Directory}
... |
PowerShellCorpus/GithubGist/ao-zkn_0cd187ef790d67321e47_raw_febe76d13c102143fe6e121b1b28783899e1b2a1_Get-URLDecode.ps1 | ao-zkn_0cd187ef790d67321e47_raw_febe76d13c102143fe6e121b1b28783899e1b2a1_Get-URLDecode.ps1 | # ------------------------------------------------------------------
# 指定した文字コードより、文字列をURLデコードする
# 関数名:Get-URLDecode
# 引数 :VALUE URLデコードする文字列
# :ENCODING 文字コード
# 戻り値:URLデコードした文字列
# ------------------------------------------------------------------
function Get-URLDecode([String]$VALUE, [String]$ENCODING){
[v... |
PowerShellCorpus/GithubGist/heedfull_4bf8e4f1a8328fbe8da8_raw_6c86678dc0f2b542e5bb0e8cadfcaba00d643578_GetLastestLogFile.ps1 | heedfull_4bf8e4f1a8328fbe8da8_raw_6c86678dc0f2b542e5bb0e8cadfcaba00d643578_GetLastestLogFile.ps1 | # Set where you want the Logs to be copied to
$to = "D:\Temp\Logs\"
# Create that folder if it doesn't exist
New-Item -Force $to -ItemType directory
# Get rid of all the files in that folder
Remove-Item $to\*
(1..4)| % {"\\Server{0:00}\d$\LogFiles\" -F $_ | %{if(Test-Path $_ ){$_ }else{}} | gci | sort Las... |
PowerShellCorpus/GithubGist/andyrat33_9019899_raw_4d2db19e378cf9c51008bbfc95922ac22577a843_oclhashcatbenchmark.ps1 | andyrat33_9019899_raw_4d2db19e378cf9c51008bbfc95922ac22577a843_oclhashcatbenchmark.ps1 | $allHashTypes = get-content -Path C:\files\oclhashcathashtypes.txt | foreach {"$(($_ -split '=')[0])"} | foreach {$_.trim()}
$exclusions = Get-Content -Path c:\files\exclusions.txt | foreach {$_.trim()}
$exe="C:\Users\Administrator\Downloads\oclhashcat\oclHashcat-1.01\oclhashcat64.exe"
$arg1 = "-m"
$arg3 = "-b"
for... |
PowerShellCorpus/GithubGist/sunnyc7_8694149_raw_420e8f279baee62bb9042eb61ead0e9bb3d72fe3_Invoke-CommandAST.ps1 | sunnyc7_8694149_raw_420e8f279baee62bb9042eb61ead0e9bb3d72fe3_Invoke-CommandAST.ps1 | #requires -Version 3
#Usage:
#Invoke-command -computername $server -scriptblock {FunctionName -param1 -param2}
# Author: Matt Graeber
# @mattifestation
# www.exploit-monday.com
function Invoke-Command
{
[CmdletBinding(DefaultParameterSetName='InProcess', HelpUri='http://go.microsoft.com/fwlink/?LinkID=13... |
PowerShellCorpus/GithubGist/mehmetkut_4f60d16568b54a9442b6_raw_5d0e7a36102c43c7d58dece494fbee69a5e8516e_ResetAzureVMCredentials.ps1 | mehmetkut_4f60d16568b54a9442b6_raw_5d0e7a36102c43c7d58dece494fbee69a5e8516e_ResetAzureVMCredentials.ps1 | <# --------------------------
Azure VM şifresini sıfırlamak için
Mehmet Kut
mail@mehmetkut.com
---------------------------- #>
Import-AzurePublishSettingsFile C:\AzureScripts\30-1-2015-credentials.publishsettings
Get-AzureSubscription
$adminCredentials = Get-Credential -Message "Yeni Giriş Bilgileri"
... |
PowerShellCorpus/GithubGist/pkirch_678cdf7b596f1f8c9bb0_raw_5231ac3e8b977f2ae886f95c34af1d896bd1e97f_Get-AzureVM-Sample.ps1 | pkirch_678cdf7b596f1f8c9bb0_raw_5231ac3e8b977f2ae886f95c34af1d896bd1e97f_Get-AzureVM-Sample.ps1 | Get-AzureVM
<# Output
ServiceName Name Status
----------- ---- ------ ... |
PowerShellCorpus/GithubGist/wiliammbr_88718fc7de3ab76f8d0b_raw_675dd1c0717632fed0b8a6837d2d1c91feb23300_GetErrorByCorrelationID.ps1 | wiliammbr_88718fc7de3ab76f8d0b_raw_675dd1c0717632fed0b8a6837d2d1c91feb23300_GetErrorByCorrelationID.ps1 | # Comando para visualizar erros
get-splogevent | ?{$_.Correlation -eq "{CorrelationId}"} | select Area, Category, Level, EventID, Message | Format-List > C:\filename.log
# Exemplo real
get-splogevent | ?{$_.Correlation -eq "bf16df13-48c8-4c45-8fc7-1c855599c7a3"} | select Area, Category, Level, EventID, Message | F... |
PowerShellCorpus/GithubGist/josheinstein_2586345_raw_0d2258a8351f4830626e6fec72f3fd1796d77c3b_Enable-AppearOffline.ps1 | josheinstein_2586345_raw_0d2258a8351f4830626e6fec72f3fd1796d77c3b_Enable-AppearOffline.ps1 | $ErrorActionPreference = 'Stop'
try {
$LyncPolicyKey = 'HKLM:\Software\Policies\Microsoft\Communicator'
if (!(Test-Path $LyncPolicyKey)) {
New-Item $LyncPolicyKey
}
Set-ItemProperty $LyncPolicyKey EnableAppearOffline -Value 1
}
catch {
Write-Warning "Could not set the appr... |
PowerShellCorpus/GithubGist/rchaganti_68a2bb55ed015d19385e_raw_fc0c10a3d66f2690207c1910c669cd441105de05_Get-AzurePowerShellMSI.ps1 | rchaganti_68a2bb55ed015d19385e_raw_fc0c10a3d66f2690207c1910c669cd441105de05_Get-AzurePowerShellMSI.ps1 | Function Test-Url {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[String] $Url
)
Process {
if ([system.uri]::IsWellFormedUriString($Url,[System.UriKind]::Absolute)) {
$true
} else {
$false
}
}
}
Function Get-... |
PowerShellCorpus/GithubGist/babadofar_11193668_raw_0885a1585676955807db1fd6ba83a9ca40ca3840_gistfile1.ps1 | babadofar_11193668_raw_0885a1585676955807db1fd6ba83a9ca40ca3840_gistfile1.ps1 | param ([Parameter(Mandatory=$true)][string]$query)
$con = New-Object -TypeName System.Data.OleDb.OleDbConnection
$con.ConnectionString = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
$con.Open()
$cmd = $con.CreateCommand()
$query = "SELECT Top 5 System.ItemPathDisplay FROM SYSTEMINDEX ... |
PowerShellCorpus/GithubGist/jonsagara_992625_raw_e48e42129e720199c1f774f57f41dd2ab3063759_Pinger.ps1 | jonsagara_992625_raw_e48e42129e720199c1f774f57f41dd2ab3063759_Pinger.ps1 | # -------------------------------------------------------------------------------------------------
# Pinger.ps1
#
# Repeatedly pings the specified server until the ping is successful.
# -------------------------------------------------------------------------------------------------
# Script params
param([Stri... |
PowerShellCorpus/GithubGist/kurukurupapa_5635973_raw_897a2fb0ece6dfa7e64e7b14178ccabbe2f41299_EchoFunc.ps1 | kurukurupapa_5635973_raw_897a2fb0ece6dfa7e64e7b14178ccabbe2f41299_EchoFunc.ps1 | # Windows PowerShell
# 引数またはパイプライン入力を受け付けるスクリプトの練習です。
function U-Echo() {
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline=$true, Mandatory=$true)] #パイプライン入力を受け取る。必須。
[ValidateNotNull()] #NULL不可
[string[]]$InputString
)
process {
$InputString | %{
... |
PowerShellCorpus/GithubGist/pipin68k_7916984b1cbb880c2e70_raw_83ead8ee0c1defb509b987712754437ab5e42f0d_Timetaken.ps1 | pipin68k_7916984b1cbb880c2e70_raw_83ead8ee0c1defb509b987712754437ab5e42f0d_Timetaken.ps1 | Read-ApacheLog *.log|
?{($_.Status -eq 200) -and ($_.Path -like "*.php")}|
Group-Object Date|
%{
$m = $_ | select -ExpandProperty Group | measure -Property TimeTaken -Average -Maximum -Minimum
$_ | Add-Member Average $m.Average
$_ | Add-Member Max $m.Maximum
$_ | Add-Member Min $m.Minimum
$_... |
PowerShellCorpus/GithubGist/wendelb_1c364bb1a36ca5916ca4_raw_5f650adae09dfb1468fa0a0a410bac98c1816eab_logoff.ps1 | wendelb_1c364bb1a36ca5916ca4_raw_5f650adae09dfb1468fa0a0a410bac98c1816eab_logoff.ps1 | #
# This background job automatically locks your Workstation after a specified amount of
# time. It will come in handy if you cannot access the screensaver settings due to policy
# restriction but want to lock your screen after a idle timeout. Or you could just
# press [Win]+[L] everytime you leave your desk ;) .
... |
PowerShellCorpus/GithubGist/pkirch_7e6049c61e18672ee52b_raw_cf67b16c746685a5c1db438794b2dd31ea77bf78_Upload-VHD.ps1 | pkirch_7e6049c61e18672ee52b_raw_cf67b16c746685a5c1db438794b2dd31ea77bf78_Upload-VHD.ps1 | # Get administration certificate.
# Get-AzurePublishSettingsFile
# Import-AzurePublishSettingsFile -PublishSettingsFile "C:\Users\pkirch\Downloads\Azure MSDN - pkirchner-9-11-2014-credentials.publishsettings"
# Settings
$SubscriptionName = "Azure MSDN - pkirchner"
$StorageAccountName = "pkmsft"
$Container = "vh... |
PowerShellCorpus/GithubGist/rposbo_2859e10bbf24ea2b689d_raw_26619b5e59e482b3307220e1f449440b6b391f17_upload-to-blob-storage.ps1 | rposbo_2859e10bbf24ea2b689d_raw_26619b5e59e482b3307220e1f449440b6b391f17_upload-to-blob-storage.ps1 | Param(
[string]$rootDir,
[string]$storage,
[string]$key,
[string]$container
)
try {
$context = New-AzureStorageContext -StorageAccountName $storage -StorageAccountKey $key
foreach ($file in Get-ChildItem -Path $rootDir)
{
$prop = @{"ContentType"="application/octetstream"}
... |
PowerShellCorpus/GithubGist/tigerswithguitars_472f54c9c994b1bcdb8b_raw_fb07ec440070c2e0bc9fca05c3879da58af7b5f4_sexy_profile.ps1 | tigerswithguitars_472f54c9c994b1bcdb8b_raw_fb07ec440070c2e0bc9fca05c3879da58af7b5f4_sexy_profile.ps1 | # Load posh-git example profile
. '{PATH TO POWERSHELL STUFF}\WindowsPowerShell\Modules\posh-git\profile.example.ps1'
#First in your powershell profile in
#C:\Users\<<username>>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
#Then in:
#C:\Users\<<username>>\Documents\WindowsPowerShell\Get-ChildI... |
PowerShellCorpus/GithubGist/bmccormack_2586415_raw_4797a793c640cf45946cb865381bf11b1e564051_Select-WindowStarted.ps1 | bmccormack_2586415_raw_4797a793c640cf45946cb865381bf11b1e564051_Select-WindowStarted.ps1 | # Uses WASP from http://wasp.codeplex.com for automating the control of Windows in Powershell.
# The purpose of this function is to start a new process and then return the window
# that was opened by the started process. This can be difficult because if you already have
# multiple windows open for that process; ther... |
PowerShellCorpus/GithubGist/chrisobriensp_7814727_raw_ef525be14448bd842651b35bfa030b1c08d44404_PS_SPO_RecreateSiteCollection.ps1 | chrisobriensp_7814727_raw_ef525be14448bd842651b35bfa030b1c08d44404_PS_SPO_RecreateSiteCollection.ps1 | . .\PS_SPO_TopOfScript.ps1
# replace these details - parameters for new site collection..
$siteCollectionUrl = "Your site URL here.."
$owner = $username
$storageQuota = 100
$resourceQuota = 30
$localeID = 1033
$timeZoneID = 2 # (GMT London)
if ($connected)
{
Write-Host "Removing site collection $si... |
PowerShellCorpus/GithubGist/gugi9000_6612271_raw_aab589128c519e1d107964f1d4b0934c8ea9498d_MailboxSizes.ps1 | gugi9000_6612271_raw_aab589128c519e1d107964f1d4b0934c8ea9498d_MailboxSizes.ps1 | # HINT: MailboxSizes.ps1 > mailboxes.txt
# Is how I find this the most useful
Get-MailboxDatabase | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize,itemcount
|
PowerShellCorpus/GithubGist/jonforums_4771531_raw_40d9bcbc939f213e9ef4e4fe5e3a30ed5dab9e6f_build_openssl.ps1 | jonforums_4771531_raw_40d9bcbc939f213e9ef4e4fe5e3a30ed5dab9e6f_build_openssl.ps1 | #requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-11 01:24:20 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add try-catch-finally error handling
# - add checkpoint support
# - support x86 and x64 builds
param(
[parameter(Ma... |
PowerShellCorpus/GithubGist/gravejester_54ec8204ab008700f6a6_raw_67795615dfafd6569dc4a4c62929b80aeb0c51af_Get-TrimmedMean.ps1 | gravejester_54ec8204ab008700f6a6_raw_67795615dfafd6569dc4a4c62929b80aeb0c51af_Get-TrimmedMean.ps1 | function Get-TrimmedMean {
<#
.SYNOPSIS
Function to calculate the trimmed mean of a set of numbers.
.DESCRIPTION
Function to calculate the trimmed mean of a set of numbers.
The default trim percent is 25, which when used will calculate the Interquartile Mean... |
PowerShellCorpus/GithubGist/colinbowern_1225231_raw_dcb84d9cf4fc604e61005c826cdacf936d89a53c_Get-Build2011Sessions.ps1 | colinbowern_1225231_raw_dcb84d9cf4fc604e61005c826cdacf936d89a53c_Get-Build2011Sessions.ps1 | [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://channel9.msdn.com/Events/BUILD/BUILD2011/RSS/wmv"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$sessionUrl = New-Object Syst... |
PowerShellCorpus/GithubGist/GuruAnt_7216135_raw_5dd0f89b7e39be82288a82169f0e5bb3376e6481_AddHashTableOfVirtualPortGroupsTovSphereHosts.ps1 | GuruAnt_7216135_raw_5dd0f89b7e39be82288a82169f0e5bb3376e6481_AddHashTableOfVirtualPortGroupsTovSphereHosts.ps1 | # Sets up virtual port groups on all hosts connected to a specific vCenter Server
# Name of vCenter Server
$strVCenterServer = "your.vCenter.Server"
# VLANs and associated VPGs
$ArrVLANs = @{
"123" = "vlanA";
"456" = "vlanB";
"789" = "vlanC";
}
# Connect to the vCenter Server
Connect-VIserver -Server... |
PowerShellCorpus/GithubGist/kujotx_4566177_raw_49d61dd813897496a3ba58bb1c949786e1d5e8bc_deleteold.ps1 | kujotx_4566177_raw_49d61dd813897496a3ba58bb1c949786e1d5e8bc_deleteold.ps1 | <#
.SYNOPSIS
Script to delete or list old files in a folder
.DESCRIPTION
Script to delete files older than x-days. The script is built to be used as a scheduled task, it automatically generates a logfile name based on the copy location and the current date/time. There are various levels of logging avai... |
PowerShellCorpus/GithubGist/goyuix_fd68db59a4f6355ee0f6_raw_a440851951fa6a8787eed0b0c853ab4b03d970e6_Modify-DefaultHive.ps1 | goyuix_fd68db59a4f6355ee0f6_raw_a440851951fa6a8787eed0b0c853ab4b03d970e6_Modify-DefaultHive.ps1 | Write-Host "Attempting to mount default registry hive"
& REG LOAD HKLM\DEFAULT C:\Users\Default\NTUSER.DAT
Push-Location 'HKLM:\DEFAULT\Software\Microsoft\Internet Explorer'
if (!(Test-Path Main)) {
Write-Warning "Adding missing default keys for IE"
New-Item Main
}
$sp = Get-ItemProperty -Path .\Main
Writ... |
PowerShellCorpus/GithubGist/rbenigno_6193856_raw_e2f21e9d90c9bb3481905cdd9306e294fff12baa_Test-DiskAccess-v2.ps1 | rbenigno_6193856_raw_e2f21e9d90c9bb3481905cdd9306e294fff12baa_Test-DiskAccess-v2.ps1 | Function Test-DiskAccess {
$filesize = 10MB #rough
$tempfolder = (Convert-Path (Get-Location -PSProvider FileSystem)) + "\NetAppTestTemp\"
If (!(Test-Path $tempfolder)){ New-Item -Path "$tempfolder" -ItemType Directory | Out-Null}
$MD5 = New-Object System.Security.Cryptography.MD5CryptoServiceProvider
while (... |
PowerShellCorpus/GithubGist/alvaroarias_4713812_raw_d94fe04f00d284b24f380edb39460fad3acb8d6c_UpdateUserProfilePictures.ps1 | alvaroarias_4713812_raw_d94fe04f00d284b24f380edb39460fad3acb8d6c_UpdateUserProfilePictures.ps1 | ## Updates User Profile Pictures
## -----------------------------
## After backup-restore process the images still contain link to the original location
## this script replaces that links to point to the current location
## .\UpdateUserProfilePictures.ps1 "<CurrentSiteUrl>"
## Remember to update the $prodUrlWildcard va... |
PowerShellCorpus/GithubGist/HowardvanRooijen_5498260_raw_c9290d37f35b582d0686e3aa4754b594498a168e_gistfile1.ps1 | HowardvanRooijen_5498260_raw_c9290d37f35b582d0686e3aa4754b594498a168e_gistfile1.ps1 | # This is the public script we call as an entry point into the deployment / configuration process
Function Invoke-Deployment
{
Param
(
$ApplicationPool,
$WebSite
)
Invoke-AppPoolTasks @PSBoundParameters
Invoke-WebSiteTasks @PSBoundParameters
}
# The main script for... |
PowerShellCorpus/GithubGist/CombustibleLemon_ca9f31ad9f41fa05a576_raw_d0bf7cc56afc36aa14ee6681e8616114b2dd519d_git-merge.ps1 | CombustibleLemon_ca9f31ad9f41fa05a576_raw_d0bf7cc56afc36aa14ee6681e8616114b2dd519d_git-merge.ps1 | # Pull from PWNAGERobotics/PWNAGE
git fetch upstream
# Checkout user master
git checkout master
# Merge PWNAGERobotics/PWNAGE:master into local user/PWNAGE:master
git merge upstream/master
# Push to user/PWNAGE:master origin
git push
|
PowerShellCorpus/GithubGist/Thermionix_0b6382b5a121942000e4_raw_c124277858afe170997fca106bd7cb24c3848d43_svn-to-git.ps1 | Thermionix_0b6382b5a121942000e4_raw_c124277858afe170997fca106bd7cb24c3848d43_svn-to-git.ps1 | $rev=40469 ; $url="svn://svn/test/branches/1.0.3" ; $clonedir="C:\source\test" ; $gitbin="${env:ProgramFiles(x86)}\Git\bin" ; cmd /c "svn diff --force --patch-compatible --diff-cmd `"$gitbin\diff.exe`" -x `"--text --unified`" -c $rev $url | git apply --directory=`"$clonedir`" -p0 --reject --verbose -"
|
PowerShellCorpus/GithubGist/wiliammbr_947bf9b5d5299fd3a117_raw_69bd05c41083b44bdcda2a0355a68a1a34284dfd_RecoverLookup.ps1 | wiliammbr_947bf9b5d5299fd3a117_raw_69bd05c41083b44bdcda2a0355a68a1a34284dfd_RecoverLookup.ps1 | $webURL = "http://localhost"
$listName = "ListName"
$columnName = "LookupColumn"
$lookupWebURL = "http://localhost"
$lookupListName = "LookupListName"
# Código do Powershell
function RepairLookup($webURL, $listName, $columnName, $lookupListName, $lookupWebURL)
{
# Obtem a Web, a Lista e a Coluna
$web = G... |
PowerShellCorpus/GithubGist/grenade_8459746_raw_b9789e64152bc5eba673bceea4300aa92f14bfed_set-connection-string.ps1 | grenade_8459746_raw_b9789e64152bc5eba673bceea4300aa92f14bfed_set-connection-string.ps1 | $connectionString = "Data Source=localhost;Initial Catalog=SomeDatabase;Integrated Security=True"
$config = "path\to\app.config"
$xml = (Get-Content $config) -as [xml]
$xml.SelectSingleNode('/configuration/connectionStrings/add[@name="ConnectionString.Key"]/@connectionString').set_InnerXML($connectionString)
$xml.S... |
PowerShellCorpus/GithubGist/philbritton_7427115_raw_602b585a6592329fbe0c68826b5af5a3f6103ebb_killerwindowsconfig.ps1 | philbritton_7427115_raw_602b585a6592329fbe0c68826b5af5a3f6103ebb_killerwindowsconfig.ps1 | #########################
# Autoinstall script using chocolatey
#########################
# Note: Net 4.0 must be installed prior to running this script
#
#Modify this line to change packages
$items = @("git-credential-winstore", "console-devel", "sublimetext3", "poshgit", "driverbooster", "revouninstallerpro", "... |
PowerShellCorpus/GithubGist/hachibeeDI_4351161_raw_4578fb32701eb3b514ca7af102be1303e7876918_generate_csv.ps1 | hachibeeDI_4351161_raw_4578fb32701eb3b514ca7af102be1303e7876918_generate_csv.ps1 |
$key_codefile = $args[0]
$random = new-Object random
function get_random_word {
$li = 'abcdefghijklmnopqrstuvwxyz'
return $li[$random.next(0, 26)]
}
function get_random_words([Int]$limit) {
return { (1..$limit | %{ get_random_word }) -join "" }.GetNewClosure()
}
#9以上だとintからあふれるので9まで
func... |
PowerShellCorpus/GithubGist/abombss_1129655_raw_d7149834d492c58e25e08934387815b6120878eb_toggle-list-sep.ps1 | abombss_1129655_raw_d7149834d492c58e25e08934387815b6120878eb_toggle-list-sep.ps1 | function toggle-list-sep
{
$path = "hkcu:\Control Panel\International"
$key = "sList"
$cur_sep = (Get-ItemProperty -path $path -name $key).$key
if ($args.Length -gt 0) { $value = $args[0] }
elseif ($cur_sep -eq ",") { $value = "|" }
else { $value = "," }
Set-ItemProperty -path $path -name $key -... |
PowerShellCorpus/GithubGist/dklevakin_8056743_raw_4588dae8f3bb5cd6da6b19d756dbcf48ebdf0882_hosts.ps1 | dklevakin_8056743_raw_4588dae8f3bb5cd6da6b19d756dbcf48ebdf0882_hosts.ps1 | #
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
r... |
PowerShellCorpus/GithubGist/tmichel_4986618_raw_605f8bb297cd3dc07273fee2aa01f97b7c3fcea9_gistfile1.ps1 | tmichel_4986618_raw_605f8bb297cd3dc07273fee2aa01f97b7c3fcea9_gistfile1.ps1 | ls -Recurse | ? { $_ -match "^(bin|obj)$" }
|
PowerShellCorpus/GithubGist/ao-zkn_9b5b0a1e4c8d9ac259a0_raw_3e9f423ed28ffaa13dae2ae5d09ff8523d5e5fe2_Convert-SnakeToCamel.ps1 | ao-zkn_9b5b0a1e4c8d9ac259a0_raw_3e9f423ed28ffaa13dae2ae5d09ff8523d5e5fe2_Convert-SnakeToCamel.ps1 | # ------------------------------------------------------------------
# スネークケースをキャメルケースに変換する
# 関数名:Convert-SnakeToCamel
# 引数 :Snake スネークケース文字列
# 戻り値:キャメルケース文字列
# ------------------------------------------------------------------
function Convert-SnakeToCamel([String]$Snake){
$regex=[regex]"_[a-zA-Z]{1}"
$regex.Matc... |
PowerShellCorpus/GithubGist/simplement-e_5382683_raw_775dfca9eba06a5945cc4dfbe585f91142a55748_get-mediation-etat.ps1 | simplement-e_5382683_raw_775dfca9eba06a5945cc4dfbe585f91142a55748_get-mediation-etat.ps1 | # la recherche à effectuer :
$recherche = '*sip*'
# si vous êtes sur un poste avec vos identifiants sauvegardés
Connect-e_session
# dans le cas contraire, vous devrez préciser les paramètres
# ServerUrl : l'url racine de votre gestion commerciale
# Username : l'adresse e-mail de connexion à utiliser
# Pass... |
PowerShellCorpus/GithubGist/ab9rf_5586006_raw_f593cf00cb8b13f3d80e86bab4977f67f2de5c18_uninstall-ie10.ps1 | ab9rf_5586006_raw_f593cf00cb8b13f3d80e86bab4977f67f2de5c18_uninstall-ie10.ps1 | $Updates = "50ff45dd-fc70-4e32-8698-a3d112e59ef1", "c0b3230a-bb79-4e44-b771-177bc224fcbf", "5f84379f-7c14-472f-b560-62a0cdec6f31", "ca2a186f-626f-401f-9cb1-68f859acbbf7"
$updatefilter = ($Updates | % { "UpdateID = '$_'" } ) -join " or "
$us = New-Object -ComObject "Microsoft.Update.Session"
$ss = $us.createupdateSearc... |
PowerShellCorpus/GithubGist/rdsimes_6190832_raw_26ba0b57cce78133784c8ad24de74aea25c3b061_restart-visual-studio.ps1 | rdsimes_6190832_raw_26ba0b57cce78133784c8ad24de74aea25c3b061_restart-visual-studio.ps1 | function Stop-Vs {
$currentApp = Split-Path $pwd -leaf
Get-Process -Name devenv | where {$_.mainWindowTitle -like "*$currentApp*"} | Stop-Process
}
function Start-Vs {
$currentApp = Split-Path $pwd -leaf
& .\$currentApp.sln
}
|
PowerShellCorpus/GithubGist/rodolfofadino_10173639_raw_0ed2a73ef413cdc5623805c8224c0715409ac365_deployiisnlb.ps1 | rodolfofadino_10173639_raw_0ed2a73ef413cdc5623805c8224c0715409ac365_deployiisnlb.ps1 | Import-Module NetworkLoadBalancingClusters
$CopyOrigin="C:\inetpub\wwwroot\xxxx"
$TimeOut=5
$Servers = New-Object System.Collections.ArrayList
$Servers.Add(@{Ip="xxx.xxx.xxx";Path="E:\xxxx";Urls=("/","/appx")})
$Servers.Add(@{Ip="xxx.xxx.xxx";Path="F:\xxxx";Urls=("/","/appx")})
$Servers.Add(@{Ip="xxx.xxx.xx... |
PowerShellCorpus/GithubGist/monahancj_7fbca58bc80443dffd38_raw_8a2ce9d108d7a0882787ed16e0008f3328ab558e_vCheckUpgradeUtils.ps1 | monahancj_7fbca58bc80443dffd38_raw_8a2ce9d108d7a0882787ed16e0008f3328ab558e_vCheckUpgradeUtils.ps1 | <#
.SYNOPSIS
Lists the variables in vCheck plugin files.
.DESCRIPTION
Plugin file will be scanned as a text file and any variables in between the "Start of Settings"
and "End of Settings" section markers will be sent out the pipeline. Files can be sent in
via the pipeline or individ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.