full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/GithubGist/chilversc_839599_raw_c7a4d67fbdec728530694f247d273554fe62c4f8_Microsoft.PowerShell_profile.ps1
chilversc_839599_raw_c7a4d67fbdec728530694f247d273554fe62c4f8_Microsoft.PowerShell_profile.ps1
function Get-HomeLocation { # Using 'Run as administrator' does not set $Home, so try other variables as well if ($variable:Home) { $variable:Home } elseif ($env:Home) { $env:Home } elseif ($env:UserProfile) { $env:UserProfile } else { $null } } function Get-HomeRelativeLocation { $h = Ge...
PowerShellCorpus/GithubGist/Steh_6051934_raw_b05c503c6e384a4f89f7f27a43138ef16a4a68dd_Get-MailboxDelegatedPermissions.ps1
Steh_6051934_raw_b05c503c6e384a4f89f7f27a43138ef16a4a68dd_Get-MailboxDelegatedPermissions.ps1
<# .SYNOPSIS Shows all Permissions on a user mailbox .DESCRIPTION shows the GrantSendOnBehalfTo field an users in MailboxPermission .EXAMPLE Get-MailboxDelegatedPermissions stehsa .PARAMETER -mailbox .NOTES Author: Steh Sa Date: July 22, 2013 #> function Ge...
PowerShellCorpus/GithubGist/jhorsman_7658365_raw_ce38f8bcfac7da78424e04d1e85017d087fe6b19_Tridion-Install-CoreService-Module.ps1
jhorsman_7658365_raw_ce38f8bcfac7da78424e04d1e85017d087fe6b19_Tridion-Install-CoreService-Module.ps1
$powershellModulePath = $env:UserProfile + "\Documents\WindowsPowerShell\Modules\Tridion-CoreService" #todo test if path is in $env:PSModulePath http://msdn.microsoft.com/en-us/library/dd878350%28v=vs.85%29.aspx $powershellClientPath = $powershellModulePath + "\Clients" Write-Debug ("PowerShell module path: {0}" -f ...
PowerShellCorpus/GithubGist/jeffpatton1971_9769168_raw_6bbe78ecd3f80687886ae5b1ebca78cf3553a12e_Copy-OuDelegation.ps1
jeffpatton1971_9769168_raw_6bbe78ecd3f80687886ae5b1ebca78cf3553a12e_Copy-OuDelegation.ps1
<# .SYNOPSIS Template script .DESCRIPTION This script sets up the basic framework that I use for all my scripts. .PARAMETER .EXAMPLE .NOTES ScriptName : Copy-Delegations.ps1 Created By : jspatton Date Coded : 03/25/2014 12:45:57 ScriptName i...
PowerShellCorpus/GithubGist/konstantindenerz_9757047_raw_7bf579c081b7f85f500eaa14f1b146dba3693c09_training.functions.output.ps1
konstantindenerz_9757047_raw_7bf579c081b7f85f500eaa14f1b146dba3693c09_training.functions.output.ps1
clear function RetrieveData($output, $param1, $param2){ #TODO: Retrieve data $output.data = 42 $output.temp = $param1 + $param2 } function ProcessData($output, $param1){ #TODO: process data $output.data++ $output.temp += $param1 } # Should be used to share state $context = @{} RetrieveData ...
PowerShellCorpus/GithubGist/rheid_32a8c47eace524649385_raw_45655055d862a787a258b639b23b448349a986ca_ctforceupdate.ps1
rheid_32a8c47eace524649385_raw_45655055d862a787a258b639b23b448349a986ca_ctforceupdate.ps1
Param( [string] $siteUrl, [string] $group ) if(!($siteUrl)) { Write-Host "Error: Site parameter missing." -ForegroundColor Red Write-Host "Usage: Update-ContentTypeHub $siteUrl $group" return } if(!($group)) { Write-Host "Error: Group parameter missing." -ForegroundColor Red Write-Host "Usage: ...
PowerShellCorpus/GithubGist/wiliammbr_06d26fc12c823b47c330_raw_dcfa1f795ac3f1f89b7477e97fb21794b79326f1_ChangePageLayout.ps1
wiliammbr_06d26fc12c823b47c330_raw_dcfa1f795ac3f1f89b7477e97fb21794b79326f1_ChangePageLayout.ps1
# Url da Web em que sua página se encontra $web = Get-SPWeb("http://awesomesharepointsite/web") # Url da página que você deseja alterar o Page Layout $file = $web.GetFile("http://awesomesharepointsite/web/pages/pagename.aspx") # Check-out na página $file.CheckOut("Online", $null) # Atualização do Page Layout p...
PowerShellCorpus/GithubGist/YoungjaeKim_e5d76f476a19224daf0a_raw_aeed412da544e30ecbc8434aff4be9de05d0ea2b_installnet35.ps1
YoungjaeKim_e5d76f476a19224daf0a_raw_aeed412da544e30ecbc8434aff4be9de05d0ea2b_installnet35.ps1
# original: http://anuchandy.blogspot.kr/2014/06/automating-net-35-installation-on-azure.html # Method that returns path to the directory holding 'installnet35.ps1' script. function Get-ScriptDirectory { $Invocation = (Get-Variable MyInvocation -Scope 1).Value Split-Path $Invocation.MyCommand.Path } # Get...
PowerShellCorpus/GithubGist/AndrewBarfield_2552163_raw_4bc16fec9f8d1096b482af18387f67bafc03e44e_gistfile1.ps1
AndrewBarfield_2552163_raw_4bc16fec9f8d1096b482af18387f67bafc03e44e_gistfile1.ps1
cls $N = 5; # -------------------------------------------------------------------------------- # # FUNCTION NAME: GenerateSet # # DESCRIPTION: Generates a set of N random integers between -9 and 9 # # -------------------------------------------------------------------------------- function GenerateSet { W...
PowerShellCorpus/GithubGist/jeppevammenkristensen_3c038b5bd9c10babac57_raw_e08097218a2498ea5a7a3a574be165df5fcff972_SetupSite.ps1
jeppevammenkristensen_3c038b5bd9c10babac57_raw_e08097218a2498ea5a7a3a574be165df5fcff972_SetupSite.ps1
Import-Module webadministration $managedRuntime = "v4.0" $Name = "Madplan" # This is of cause a dependency on Powershell version 3.0 $webPath = join-path $PSScriptRoot $Name Write-Host $webPath pushd iis:\apppools if (!(Test-Path $Name)) { Write-Host "Requesting your password" $credential ...
PowerShellCorpus/GithubGist/jeffpatton1971_8188439_raw_abb41a44771904e62fbb5126579cdfb446c75262_Setup-PullServer.ps1
jeffpatton1971_8188439_raw_abb41a44771904e62fbb5126579cdfb446c75262_Setup-PullServer.ps1
$SourcePath = "$($pshome)\modules\psdesiredstateconfiguration\pullserver" $DestinationPath = "C:\inetpub\wwwroot\PSDSCPullServer" $AppPool = "DSCAppPool" New-Item C:\inetpub\wwwroot\PSDSCPullServer\bin -ItemType directory -Force Copy-Item "$($SourcePath)\psdscpullserver.*" $DestinationPath Copy-Item "$($SourcePa...
PowerShellCorpus/GithubGist/mcollier_5309605_raw_96f69f957cff4a45cd0ca7fc25ab9a905e2f2b0b_BuildAndDeploy.ps1
mcollier_5309605_raw_96f69f957cff4a45cd0ca7fc25ab9a905e2f2b0b_BuildAndDeploy.ps1
$Error.Clear() $BuildConfiguration = 'Debug' Write-Host "*** Starting to build the project ***" C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe c:\Projects\MyApp\MyApp.ccproj ` /p:Configuration=$BuildConfiguration ` /t:CorePublish if ($LASTEXITCODE -ne 0) { throw "Build Failed" } Write-Hos...
PowerShellCorpus/GithubGist/mintsoft_5917067_raw_d094b25982ab308cefb4459c43e53fedb99670e7_ExportSQLTasks.ps1
mintsoft_5917067_raw_d094b25982ab308cefb4459c43e53fedb99670e7_ExportSQLTasks.ps1
import-module SSIS $ssis_package = "D:\MyFile.dtsx"; $package = Get-ISPackage -path $ssis_package; $package.Executables | Where-Object { $_.InnerObject -like 'Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask' } | %{ $fn = $_.Name+".sql"; $_.InnerObject.SqlStatementSource > $fn }
PowerShellCorpus/GithubGist/josheinstein_3859588_raw_f0ce1c346393ab45894ed1c8816605af4505b8cd_New-PSObject.ps1
josheinstein_3859588_raw_f0ce1c346393ab45894ed1c8816605af4505b8cd_New-PSObject.ps1
# PowerShell 3 adds the new [PSCustomObject] pseudo type attribute which # lets you declare an object literal using a syntax very similar to that # of an ordinary Hashtable. (There's also a new [Ordered] attribute that # creates a hash table with the order of keys preserved.) # # But it only lets you declare an ob...
PowerShellCorpus/GithubGist/pavelbinar_7343002_raw_b452cdde7618e2bd9323233f754a3a6cb34777a7_gistfile1.ps1
pavelbinar_7343002_raw_b452cdde7618e2bd9323233f754a3a6cb34777a7_gistfile1.ps1
# Source: http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo # This looks like a permissions issue in your home directory. To reclaim ownership of the .npm directory execute sudo chown -R `whoami` ~/.npm # Also you will need the write permission in node_modules directory: sudo chown -R `w...
PowerShellCorpus/GithubGist/rytmis_4178996_raw_80858abd7e88e2f74c8c365fbb0f8e4685b4e84e_add-reply-address.ps1
rytmis_4178996_raw_80858abd7e88e2f74c8c365fbb0f8e4685b4e84e_add-reply-address.ps1
$addresses = $principal.Addresses $addresses.Add((New-MsolServicePrincipalAddresses -Address http://localhost:81)) $addresses.Add((New-MsolServicePrincipalAddresses -Address http://my-deployment-endpoint.cloudapp.net)) Set-MsolServicePrincipal -AppPrincipalId 3dc125e6-d518-40d2-9392-87a03dac8f68 -Addresses $addresse...
PowerShellCorpus/GithubGist/benbrandt22_3606e55fe947a9227bd4_raw_a4a7994fc1a8189dc5ef7f5f083c35826995d5ca_Objectify.ps1
benbrandt22_3606e55fe947a9227bd4_raw_a4a7994fc1a8189dc5ef7f5f083c35826995d5ca_Objectify.ps1
# Objectify.ps1 # Ben Brandt - July 18, 2014 # Turns a tab-delimited table from the clipboard text, and converts it to a List of objects in C# code. # Useful for taking data copied from SQL Management Studio (with Headers) and converting it to in-memory objects for use as test data. function Get-ClipboardText()...
PowerShellCorpus/GithubGist/jrotello_3fa07e0b522b411f85ef_raw_7863e6ebd50d330e42fcb054449d2bdce3179bf8_gistfile1.ps1
jrotello_3fa07e0b522b411f85ef_raw_7863e6ebd50d330e42fcb054449d2bdce3179bf8_gistfile1.ps1
function Remove-FiddlerCertificates { $fiddlerCert = "CN=DO_NOT_TRUST_FiddlerRoot" ls Cert:\CurrentUser\My | ? { # All certificates issued by the fiddler root certificate. $PSItem.Issuer.StartsWith($fiddlerCert) -and # But not the fiddler root certificate itself. -not $PS...
PowerShellCorpus/GithubGist/dpanda_5830306_raw_08778c40e8e5ceedd80a8ffbba4f544c1c4d749c_gistfile1.ps1
dpanda_5830306_raw_08778c40e8e5ceedd80a8ffbba4f544c1c4d749c_gistfile1.ps1
#!/bin/bash cd img images=(`ls *.png *.jpg *.jpeg *.gif 2> /dev/null`) # get all images cd ../sass scss=(`ls *.scss */*.scss`) # get all compass files usedImg=() unusedImg=() for i in "${images[@]}"; do # for each image... : used="not-used" for f in "${scss[@]}" ; do # for each compass file... : ...
PowerShellCorpus/GithubGist/jole78_5102112_raw_0d2a3175dbd66d9a3167df4f52ef7228686a4fe7_New-WDPublishSettings.ps1
jole78_5102112_raw_0d2a3175dbd66d9a3167df4f52ef7228686a4fe7_New-WDPublishSettings.ps1
Add-PSSnapin WDeploySnapin3.0 New-WDPublishSettings ` -ComputerName "virjole-wfe1" ` -EncryptPassword:$true ` -FileName "C:\temp\virjole-wfe1.publishsettings" ` -UserId "hyper-v\wd_remote" ` -Password "pass@word1" ` -AgentType:WMSvc ` -AllowUntrusted:$true
PowerShellCorpus/GithubGist/phantomtypist_9a2c3ac50d55c726f7b0_raw_f322bf364a481fddabadb1b3a3e1172471f18bf2_Boxstarter-01-Update-Windows.ps1
phantomtypist_9a2c3ac50d55c726f7b0_raw_f322bf364a481fddabadb1b3a3e1172471f18bf2_Boxstarter-01-Update-Windows.ps1
# http://boxstarter.org/package/url? # Boxstarter options $Boxstarter.RebootOk=$true # Allow reboots? $Boxstarter.NoPassword=$false # Is this a machine with no login password? $Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot ##################### # BEGIN CONFIGURATION ###...
PowerShellCorpus/GithubGist/belotn_7198387_raw_982cace4cb21e1be1c49aacbeca2bafe4fb38a1e_RemoteInstall.ps1
belotn_7198387_raw_982cace4cb21e1be1c49aacbeca2bafe4fb38a1e_RemoteInstall.ps1
######################################################### # FileName RemoteInstall.ps1 # # Version 0.3 # # Author Nicolas # ######################################################### # ChangeLog # # ...
PowerShellCorpus/GithubGist/quakersquares_5548299_raw_419c3e9a5c078b82d0fecd2bfda64d2f8c91eba3_ReplStatus.ps1
quakersquares_5548299_raw_419c3e9a5c078b82d0fecd2bfda64d2f8c91eba3_ReplStatus.ps1
# ============================================================================================== # NAME: Check-Replication # # AUTHOR: Maish Saidel-Keesing # DATE : 27/04/2010 # # COMMENT: Will check the replication status and if there are failures will send an email to the # Assigned Addresses. # ** Requires R...
PowerShellCorpus/GithubGist/Steh_8728329_raw_af9b5e3528591c13d89bbc573cfa24d32da7f323_MessageTrackingOU.ps1
Steh_8728329_raw_af9b5e3528591c13d89bbc573cfa24d32da7f323_MessageTrackingOU.ps1
$mbx = Get-Mailbox -OrganizationalUnit <OU> $srv = Get-TransportServer stehsa-* | Sort-Object Name ForEach($i in $mbx) { $i.PrimarySmtpAddress ForEach($x in $srv) { $x.Name Get-MessageTrackingLog -Server $x.DistinguishedName -Recipients $i.PrimarySmtpAddress | Select-Object Sender >> C:\Ex...
PowerShellCorpus/GithubGist/stevengorrell_9974119_raw_f47e5cd17c9eb211b4a0db7b2f6e7c791d6bcdd3_Bootstrap-EC2-Windows-CloudInit.ps1
stevengorrell_9974119_raw_f47e5cd17c9eb211b4a0db7b2f6e7c791d6bcdd3_Bootstrap-EC2-Windows-CloudInit.ps1
#ps1 # Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM # AND install 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 instance fires up! # This...
PowerShellCorpus/GithubGist/janikvonrotz_7823559_raw_90e9932228c405da72ad06792fddf7e0210d77d2_Check-PSCompatibility.ps1
janikvonrotz_7823559_raw_90e9932228c405da72ad06792fddf7e0210d77d2_Check-PSCompatibility.ps1
# Check for executeable if ((Get-Command "cmdkey.exe") -and (Get-Command "mstsc.exe")) { } # Execute with Powershell version 2 instead of version 3 and higher if($Host.Version.Major -gt 2){ powershell -Version 2 $MyInvocation.MyCommand.Definition exit } # only powershell 2 and higher if($Host.Version.Ma...
PowerShellCorpus/GithubGist/sunnyc7_cc62b79263d261d898e6_raw_81151e84015846f95186c6c4ebf59c9c91874707_Set-ReverseString.ps1
sunnyc7_cc62b79263d261d898e6_raw_81151e84015846f95186c6c4ebf59c9c91874707_Set-ReverseString.ps1
# Golang inspired. # https://www.youtube.com/watch?v=XCsL89YtqCs Function Set-ReverseString { param ( [string]$s) process { $b = [char[]] ($s) for ($i =0; $i -lt $(($s.Length)/2) ;$i++){ $j =$b.Length - $i -1 $b[$i],$b[$j] = $b[$j],$b[$i] } [string]::join("",$...
PowerShellCorpus/GithubGist/scichelli_4151973_raw_4b7dba5d636e5db0b5c649f21d617f2ccc52d5fa_sleep.ps1
scichelli_4151973_raw_4b7dba5d636e5db0b5c649f21d617f2ccc52d5fa_sleep.ps1
$WarningDuration = 5 $MessagePlural = "" if ($WarningDuration -gt 1) { $MessagePlural = "s" } [System.Media.SystemSounds]::Asterisk.play() [void] [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [windows.forms.messagebox]::show(("Save your work. Sleep in {0} minute{1}." -f $WarningDuration, $Me...
PowerShellCorpus/GithubGist/mikeplate_69a270411f23a4f49298_raw_3b6225eb530b597463120780a52107756d357de2_list_net_versions.ps1
mikeplate_69a270411f23a4f49298_raw_3b6225eb530b597463120780a52107756d357de2_list_net_versions.ps1
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version -EA 0 | Where { $_.PSChildName -match '^(?!S)\p{L}'} | Select PSChildName, Version
PowerShellCorpus/GithubGist/mortenya_fe07bb219925e114fcf3_raw_b1d451c5eefe8d633aaec02fef6cd993f4052a34_Generate-RandomPassword.ps1
mortenya_fe07bb219925e114fcf3_raw_b1d451c5eefe8d633aaec02fef6cd993f4052a34_Generate-RandomPassword.ps1
$Computers = Get-ADComputer -Filter * | Where distinguishedName -NotLike "*DC*" $user = Get-WmiObject Win32_UserAccount -Filter "LocalAccount=true" | where { $_.Name -eq 'Administrator' } $Count = 1 $CharSet1 = [Char[]]"abcdefghijklmnopqrstuvwxyz1234567890" ForEach ($c in $Computers) { Write-Progress -Id 1 -Ac...
PowerShellCorpus/GithubGist/HowardvanRooijen_4313af807f8405b1b01b_raw_dd736e09269c762361f69676039e5308fbcc6edd_NotifyNewRelic.ps1
HowardvanRooijen_4313af807f8405b1b01b_raw_dd736e09269c762361f69676039e5308fbcc6edd_NotifyNewRelic.ps1
try { $body = ""; if ([String]::IsNullOrEmpty($apiKey)){ throw "API Key is required" } else { $headers += @{"x-api-key"=($apiKey)}; } if ([String]::IsNullOrEmpty($appName)){ throw "App Name is required" } else { $body += "deployment[app_name]=$appName"; } if (![String...
PowerShellCorpus/GithubGist/kmpm_2996955_raw_2e6d7cb3c7b3e9dcb94be3a372ac82292e175483_GitHub.PowerShell_profile.ps1
kmpm_2996955_raw_2e6d7cb3c7b3e9dcb94be3a372ac82292e175483_GitHub.PowerShell_profile.ps1
# <My Documents>\WindowsPowershell\GitHub.PowerShell_profile.ps1 # If Posh-Git environment is defined, load it. if (test-path env:posh_git) { . $env:posh_git } # If module is installed in a default location ($env:PSModulePath), # use this instead (see about_Modules for more information): # Import-Module pos...
PowerShellCorpus/GithubGist/GuruAnt_7215567_raw_bcd1def81db9ba941d53104b9fdc9f3117e6b8e2_RenameVMTemplates.ps1
GuruAnt_7215567_raw_bcd1def81db9ba941d53104b9fdc9f3117e6b8e2_RenameVMTemplates.ps1
# Get all templates $objTemplates = Get-Template # Loop through the templates ForEach ($objTemplate in $objTemplates){ # Set the $StrInterimTemplateName variable to the template name, replacing the string "Tmpl" with an empty string $StrInterimTemplateName = ($objTemplate.Name -replace("Tmpl","")) # As the s...
PowerShellCorpus/GithubGist/zakird_a8582ced2f50cfe1c702_raw_ca3cc10d035df0ca788615876da709cf20541726_get-root-cas.ps1
zakird_a8582ced2f50cfe1c702_raw_ca3cc10d035df0ca788615876da709cf20541726_get-root-cas.ps1
$type = [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert get-childitem -path cert:\LocalMachine\AuthRoot | ForEach-Object { $hash = $_.GetCertHashString() [System.IO.File]::WriteAllBytes("$hash.der", $_.export($type) ) }
PowerShellCorpus/GithubGist/dotps1_9215724_raw_a63e0b7650a820b12beef703dbf703211954e765_Get-UnEncryptedWorkstationsFromCMDB.ps1
dotps1_9215724_raw_a63e0b7650a820b12beef703dbf703211954e765_Get-UnEncryptedWorkstationsFromCMDB.ps1
<# .SYNOPSIS Queries ConfigMgr Database for BitLockerProtectionStatus Boolean Value. .DESCRIPTION Queries ConfigMgr Database for any workstation that has completed a Hardware Inventory Scan, looks for the BitLockerProtectionStatus Value, 1 is fully encrypted and Protection is on, 0 for anything else. ...
PowerShellCorpus/GithubGist/geoffreysmith_912395_raw_d1d625417da9f11736c2c4b211a721e405b7be9a_MvcScaffolding.Controller.ps1
geoffreysmith_912395_raw_d1d625417da9f11736c2c4b211a721e405b7be9a_MvcScaffolding.Controller.ps1
[T4Scaffolding.ControllerScaffolder("Controller with read/write action and views, using EF data access code", Description = "Adds an ASP.NET MVC controller with views and data access code", SupportsModelType = $true, SupportsDataContextType = $true, SupportsViewScaffolder = $true)][CmdletBinding()] param( [para...
PowerShellCorpus/GithubGist/tanordheim_76fc9343e687a5efcd66_raw_67993ef604a0b6026417068d96434829bf1ef632_DeployAzureWebsite.ps1
tanordheim_76fc9343e687a5efcd66_raw_67993ef604a0b6026417068d96434829bf1ef632_DeployAzureWebsite.ps1
param ( [Parameter(Position = 0, Mandatory=$True)] [string]$ProjectName, [Parameter(Position = 1, Mandatory=$True)] [string]$SiteName, [Parameter(Position = 2, Mandatory=$True)] [string]$Environment ) $NewRelicLicenseKey = "<license key>" $PackagePath = "$ProjectName.csproj.zip" ...
PowerShellCorpus/GithubGist/andreaswasita_d9bc7f0ba1b557600ce5_raw_37363ca581e3d4167bd61b64ee4af533126803dd_Get-AzureVMExtension%20IaaSAntimalware.ps1
andreaswasita_d9bc7f0ba1b557600ce5_raw_37363ca581e3d4167bd61b64ee4af533126803dd_Get-AzureVMExtension%20IaaSAntimalware.ps1
$servicename = Read-Host -Prompt 'Azure Cloud Service:' $name = Read-Host -Prompt 'Azure VM:' # Get the VM $vm = Get-AzureVM –ServiceName $servicename –Name $name # Get Microsoft Antimalware Agent on Virtual Machine Get-AzureVMExtension -Publisher Microsoft.Azure.Security -ExtensionName IaaSAntimalware -Version 1.* -...
PowerShellCorpus/GithubGist/mgreenegit_c366f14ed82c6139aa3c_raw_1a00aa7e182cfad964cd1d1f98afbe2bf1179a48_RemoteDesktop.ps1
mgreenegit_c366f14ed82c6139aa3c_raw_1a00aa7e182cfad964cd1d1f98afbe2bf1179a48_RemoteDesktop.ps1
# Run each commented section individually # Download new modules from the DSC Resource Kit Install-Module xRemoteDesktopAdmin, xNetworking # Generate a Configuration MOF file Configuration RemoteDesktop { Import-DscResource -ModuleName xRemoteDesktopAdmin, xNetworking Node localhost { x...
PowerShellCorpus/GithubGist/jhorsman_7adf1ce64e8870abfeb6_raw_f197a42b8ede1f546c28eae36f830bc3b289dcee_ServerAsWorkstation.ps1
jhorsman_7adf1ce64e8870abfeb6_raw_f197a42b8ede1f546c28eae36f830bc3b289dcee_ServerAsWorkstation.ps1
function SetOrAdd-ItemProperty ($key, $name, $value) { if (!(Test-Path $key)) { New-Item $key > $null } Set-ItemProperty $key $name $value } function Disable-ShutdownEventTracker { # source: http://technet.microsoft.com/en-us/library/cc776766(v=ws.10).aspx Out-BoxstarterLog...
PowerShellCorpus/GithubGist/urda_7164939_raw_ce486066e91774886c85932adc6a90e73ce87b57_Get-Checksum.ps1
urda_7164939_raw_ce486066e91774886c85932adc6a90e73ce87b57_Get-Checksum.ps1
function Get-Checksum { Param ( [string]$File=$(throw("You must specify a filename to get the checksum of.")), [ValidateSet("sha1","md5")] [string]$Algorithm="sha1" ) $ActualFile = Resolve-Path $File $fs = New-Object System.IO.FileStream("$($ActualFile.Path)", "Open")...
PowerShellCorpus/GithubGist/zvolkov_5e312919ce31135e366f_raw_836275fbf5085b0d78e5acd3fa3fba8747c35228_devimage.ps1
zvolkov_5e312919ce31135e366f_raw_836275fbf5085b0d78e5acd3fa3fba8747c35228_devimage.ps1
Set-ExecutionPolicy Unrestricted Set-ExplorerOptions –showFileExtensions -EnableShowFullPathInTitleBar Set-TaskbarSmall Install-WindowsUpdate –AcceptEula cinstm VisualStudio2012Premium -InstallArguments "/Features:'WebTools SQL'" cinstm VisualStudio2013Premium -InstallArguments "/Features:'WebTools SQL'" cinst r...
PowerShellCorpus/GithubGist/angusmacdonald_8584382_raw_0e7a55aba96c3d94f7f6efa65f18f6a73e528ae8_Get-DuplicateFileNames.ps1
angusmacdonald_8584382_raw_0e7a55aba96c3d94f7f6efa65f18f6a73e528ae8_Get-DuplicateFileNames.ps1
# Created by Angus Macdonald (amacdonald AT aetherworks.com) # This takes the path of a directory to search recursively for files with the same name. # The directory must be ended with a slash. [CmdletBinding()] param ( [string] $Path ) # Use current working directory if none is specified. if (-not $Path) { ...
PowerShellCorpus/GithubGist/GuruAnt_7213409_raw_4d5cb3c08f8c94e156b77cd34561be807033cb31_VMAndGuestNameMismatchFinder.ps1
GuruAnt_7213409_raw_4d5cb3c08f8c94e156b77cd34561be807033cb31_VMAndGuestNameMismatchFinder.ps1
# Get all of the VMs as an object $objVMs = Get-VM # Loop through all of the VMs ForEach ($objVM in $objVMs){ # Get the VM Guest object (which contains the DNS information) $objGuest = Get-VMGuest -VM $objVM # Set a variable to the VM object name $objVMName = $objVM.Name # Set a variable to the DNS na...
PowerShellCorpus/GithubGist/matthewbadeau_3284562_raw_542c4d8c0e3246f5411bdf0cd33e39b51fefaa08_gistfile1.ps1
matthewbadeau_3284562_raw_542c4d8c0e3246f5411bdf0cd33e39b51fefaa08_gistfile1.ps1
function Get-HMACSHA1([string]$publicKey, [string]$privateKey){ $hmacsha = New-Object System.Security.Cryptography.HMACSHA1 [byte[]]$publicKeyBytes = [System.Text.Encoding]::ASCII.GetBytes($publicKey) [byte[]]$privateKeyBytes = [System.Text.Encoding]::ASCII.GetBytes($privateKey) $hmacsha.Key = $...
PowerShellCorpus/GithubGist/pkirch_ab9c9ec3cd2314b47438_raw_e3a659e29f06bc01d2d86c8b2d0c353a4e44b65b_MVA02-Endpoints.ps1
pkirch_ab9c9ec3cd2314b47438_raw_e3a659e29f06bc01d2d86c8b2d0c353a4e44b65b_MVA02-Endpoints.ps1
# sample 1 Get-AzureVM | Get-AzureEndpoint # sample 2 Get-AzureVM | Get-AzureEndpoint | Select-Object -Property Vip, Name, Port, LocalPort | Format-Table -AutoSize # sample 3 Get-AzureVM | ForEach-Object { # Save the current VM for use in the nested ForEach. $vm = $_ # Get all endpoints of the c...
PowerShellCorpus/GithubGist/tinchou_8709569_raw_a09fdbe01b2fc4177ed56a21d8f4132ccc835e25_AzureSDKTestPath.ps1
tinchou_8709569_raw_a09fdbe01b2fc4177ed56a21d8f4132ccc835e25_AzureSDKTestPath.ps1
try { $key = 'HKLM:\SOFTWARE\Microsoft\Microsoft SDKs\ServiceHosting' $registryProperty = Get-ChildItem $key -ErrorAction Stop | Sort CreationTime -Descending | Select -First 1 | Get-ItemProperty -ErrorAction Stop $fullVersion = ($registryProperty | Select FullVersion).FullVersion $installPath = ($...
PowerShellCorpus/GithubGist/miriyagi_6779410_raw_0a836f0e024ce0baba34cc54c274c02d60e3e8c2_Archive-OldOutlookAttachments.ps1
miriyagi_6779410_raw_0a836f0e024ce0baba34cc54c274c02d60e3e8c2_Archive-OldOutlookAttachments.ps1
# Archive-OldOutlookAttachments.ps1 # Dual-licensed under CC0 1.0 (http://creativecommons.org/publicdomain/zero/1.0/) # or NYSL Version 0.9982 (http://www.kmonos.net/nysl/NYSL.TXT) $ErrorActionPreference = "Stop" [object] $outlook = New-Object -ComObject Outlook.Application [object] $folder = $outlook.Session.Acco...
PowerShellCorpus/GithubGist/RhysC_5328485_raw_269fe1dd14d3d77b1e5031f9f4f15a11ce371cc0_GetInstalledApps.ps1
RhysC_5328485_raw_269fe1dd14d3d77b1e5031f9f4f15a11ce371cc0_GetInstalledApps.ps1
#32 bit path - "hklm:\software\microsoft\windows\currentversion\uninstall" $regInstallPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" $installed = gci $regInstallPath | foreach { gp $_.PSPath } | select DisplayVersion,InstallDate,ModifyPath,Publisher,UninstallString,Language,Di...
PowerShellCorpus/GithubGist/toburger_4493889_raw_5faec90991a03d352896267d3991c7b71a2cf546_Get-GistFile.ps1
toburger_4493889_raw_5faec90991a03d352896267d3991c7b71a2cf546_Get-GistFile.ps1
param([Parameter(Mandatory)]$Id) $response = Invoke-WebRequest https://api.github.com/gists/$Id $gist = $response.Content | ConvertFrom-Json $gist.files | gm -MemberType NoteProperty | select -First 1 | % { $file = $gist.files."$($_.Name)" $file.content Write-Verbose "filename: $($file.filename)...
PowerShellCorpus/GithubGist/mcollier_5309590_raw_252a0a68a7700beaace18381d662f0889f30caf5_AzurePublish.ps1
mcollier_5309590_raw_252a0a68a7700beaace18381d662f0889f30caf5_AzurePublish.ps1
#NOTE: This script is based on the Microsoft provided guidance example at # https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/. Param( [parameter(Mandatory=$true)] $serviceName, [parameter(Mandatory=$true)] $storageAccountName, [parameter(Mandatory=$true)] ...
PowerShellCorpus/GithubGist/nopslider_c8db16d30339faaa12ac_raw_283086fac85f74767c0d5d37a2d2845d1219184e_gistfile1.ps1
nopslider_c8db16d30339faaa12ac_raw_283086fac85f74767c0d5d37a2d2845d1219184e_gistfile1.ps1
Get-ADUser -Filter * -Properties * ` | where {($_.enabled -eq $true) -and ($_.lockedout -eq $false)} ` | where {$_.passwordlastset -lt (Get-Date).AddYears(-1)} ` | select SamAccountName, passwordlastset ` | sort passwordlastset
PowerShellCorpus/GithubGist/forsythetony_09057749fa755a3a18a2_raw_7808710c22bf264117cea80f678fa0599b0d6843_convertVideos.ps1
forsythetony_09057749fa755a3a18a2_raw_7808710c22bf264117cea80f678fa0599b0d6843_convertVideos.ps1
# Function definitions function getUserData { Do { $rootPath = Read-Host "Enter the path to the folder containing video files (NOT /userid)" # $rootPath = "C:\Users\muengrcerthospkinect\Desktop\testing" $pathTest = Test-Path $rootPath if (!$pathTest) { Write-Host "Path...
PowerShellCorpus/GithubGist/thinktainer_6762746_raw_9ccfba495f0de5666acc5300d64c41713ed65e9c_publish_azure.ps1
thinktainer_6762746_raw_9ccfba495f0de5666acc5300d64c41713ed65e9c_publish_azure.ps1
Param( $serviceName = "", $storageAccountName = "", $packageLocation = "", $cloudConfigLocation = "", $environment = "Staging", $deploymentLabel = "ContinuousDeploy to $servicename", $timeStampFormat = "g", $alwaysDeleteExistingDeployments = 1, $e...
PowerShellCorpus/GithubGist/ser1zw_2160887_raw_2dcb0cb6f2528cc2afa5181a5eb4c683cef21e0b_dragdrop.ps1
ser1zw_2160887_raw_2dcb0cb6f2528cc2afa5181a5eb4c683cef21e0b_dragdrop.ps1
# PowerShell Drag & Drop sample # Usage: # powershell -sta -file dragdrop.ps1 # (-sta flag is required) # Function DragDropSample() { [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $form = New-Object Windows.Forms.Form $form.text = "Drag&Drop sample" $listBox = New-Object Windo...
PowerShellCorpus/GithubGist/guitarrapc_8426022_raw_66af7720ea4db570fc382ad33f8be824bfda2270_ToastNotification-Sample.ps1
guitarrapc_8426022_raw_66af7720ea4db570fc382ad33f8be824bfda2270_ToastNotification-Sample.ps1
# Code conversion from C# to PowerShell # http://msdn.microsoft.com/en-us/library/windows/apps/hh802768.aspx # nuget Windows 7 API Code Pack -Shell # http://nugetmusthaves.com/Package/Windows7APICodePack-Shell # Install-Package Windows7APICodePack-Shell Add-Type -Path .\Microsoft.WindowsAPICodePack.dll Add-Typ...
PowerShellCorpus/GithubGist/aanari_2635030_raw_a1e16893dc95b72508b1bf527aa7d8e7094ee9b4_changelog.ps1
aanari_2635030_raw_a1e16893dc95b72508b1bf527aa7d8e7094ee9b4_changelog.ps1
$commitlog = '<!doctype html><html><body>' foreach($line in git log --no-merges --pretty=%H%n%B){ if ($line -match '\w{40}') { $commit = git show $line -- Properties/AssemblyInfo.cs [string] $vers = $commit -match '\+\[assembly: AssemblyVersion\("(\d\.\d\.\d\.\d)"\)\]' if ($vers) { $vnum = $vers.Split('\"')[...
PowerShellCorpus/GithubGist/RMcD_24fac061e33422f26a3d_raw_567cb5f9d530e46e4aa06749209dc8909eb73da4_gistfile1.ps1
RMcD_24fac061e33422f26a3d_raw_567cb5f9d530e46e4aa06749209dc8909eb73da4_gistfile1.ps1
$cloudService="corp-ods-db" $ilb="corp-ods-lb" $subnet="AlwaysOn-Static" $IP="10.10.4.7" Add-AzureInternalLoadBalancer -ServiceName $cloudService -InternalLoadBalancerName $ilb –SubnetName $subnet –StaticVNetIPAddress $IP $vmNames=@("corp-ods-db1","corp-ods-db2") $endPointName="SQLServer" $prot="tcp" $localPo...
PowerShellCorpus/GithubGist/pfmoore_21d3450bb413a8713053_raw_642b7d8287661f77fefe153f06b811b905af2ba1_vex.ps1
pfmoore_21d3450bb413a8713053_raw_642b7d8287661f77fefe153f06b811b905af2ba1_vex.ps1
[CmdletBinding(DefaultParameterSetName="ByName")] Param ( [Parameter(Position=0, Mandatory=$true, ParameterSetName="ByName")] [String] $VE, [Parameter(Position=1)] [ScriptBlock]$sb, [Parameter(Mandatory=$true, ParameterSetName="ByPath")] [String] $Path, [Switch]$Make, [Switch]$Rem...
PowerShellCorpus/GithubGist/r-tanner-f_5367976_raw_682629cc19941a270a5c89d432b202b78034b402_check_iexplorer_memory.ps1
r-tanner-f_5367976_raw_682629cc19941a270a5c89d432b202b78034b402_check_iexplorer_memory.ps1
$IESessions = Get-WmiObject Win32_PerfRawData_PerfProc_Process | Where {$_.Name -like "iexplore*"} ForEach ($ie in $IEsessions) {$pws += $ie.WorkingSetPrivate} $pws = $pws/1024/1024/1024 $pws = [System.Math]::Round($pws,2) $output = "$pws GB Working Set|'PrivateWorkingSet(GB)'=$pws`G;4;5;0;8;" Write-Host $ou...
PowerShellCorpus/GithubGist/jrampon_fb985c8ebf978c940230_raw_5fbc76e419ca954349e8f5e39a0f81d68e6d67c2_boxstarter-bootstrap.ps1
jrampon_fb985c8ebf978c940230_raw_5fbc76e419ca954349e8f5e39a0f81d68e6d67c2_boxstarter-bootstrap.ps1
# From a command prompt: # START http://boxstarter.org/package/nr/url?<raw-url> # Boxstarter options $Boxstarter.RebootOk=$true # Allow reboots? $Boxstarter.NoPassword=$false # Is this a machine with no login password? $Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot # B...
PowerShellCorpus/GithubGist/jeffpatton1971_8440245_raw_b433ad297d450cd43cb21576aa952a56b86e778e_New-RulesFromNetstat.ps1
jeffpatton1971_8440245_raw_b433ad297d450cd43cb21576aa952a56b86e778e_New-RulesFromNetstat.ps1
<# Create FW rules for TCP and UDP Listening Ports netstat -an -p tcp |Select-String "Listening" netstat -an -p udp |Select-String "Listening" for each entry in netstat create firewall rule name = -p tcp|udp port port # description = automatic allow rule generated by powershe...
PowerShellCorpus/GithubGist/guitarrapc_85288a1450a15e1d7bb5_raw_3e73a2856b1d47b0f640fd06fc28fd5b096585d5_CanEvaluate.ps1
guitarrapc_85288a1450a15e1d7bb5_raw_3e73a2856b1d47b0f640fd06fc28fd5b096585d5_CanEvaluate.ps1
"{{0}}" -f $hoge.hoge
PowerShellCorpus/GithubGist/jorvik_6a3b431506619e0a2c24_raw_3085bf34c4fec8a9f9514c275f60f3031bdc5d46_PartAlign.ps1
jorvik_6a3b431506619e0a2c24_raw_3085bf34c4fec8a9f9514c275f60f3031bdc5d46_PartAlign.ps1
$partitions = Get-WmiObject -computerName "." Win32_DiskPartition $partitions | foreach { Get-WmiObject -computerName "." -query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($_.DeviceID)'} WHERE AssocClass = Win32_LogicalDiskToPartition" | add-member -membertype noteproperty PartitionName $_.Name -passthru...
PowerShellCorpus/GithubGist/sjwaight_b9723e3488d98873dd91_raw_61f799b75222dd37877a33b33caad94369678d96_create-linux-vm.ps1
sjwaight_b9723e3488d98873dd91_raw_61f799b75222dd37877a33b33caad94369678d96_create-linux-vm.ps1
# Script assumes you have setup your subscription and # have a default storage account in West US. # You should change these to values you want. $cloudService = "{cloudservice}" $hostname = "{dockermanagementhost}" $linuxUser = "{linxuser}" $linuxPass = "{linxpasswd}" $location = "West US" # use CentOS 7 i...
PowerShellCorpus/GithubGist/alexspence_f474ae7656c910004354_raw_60932486ee99d8d33519b5a2936cbe3431e8ff7f_RavenDefrag.ps1
alexspence_f474ae7656c910004354_raw_60932486ee99d8d33519b5a2936cbe3431e8ff7f_RavenDefrag.ps1
param( [parameter(Mandatory=$true)] [string] $databaseDirectory ) Function Format-FileSize() { Param ([int]$size) If ($size -gt 1TB) {[string]::Format("{0:0.00} TB", $size / 1TB)} ElseIf ($size -gt 1GB) {[string]::Format("{0:0.00} GB", $size / 1GB)} ElseIf ($size -gt 1MB) {[string]::Format("{0:...
PowerShellCorpus/GithubGist/bigoals365_7f6831e5361e507ea007_raw_efaa9818a3f73340ddc0ae1e72866581b311aa03_find_suspect_kbs.ps1
bigoals365_7f6831e5361e507ea007_raw_efaa9818a3f73340ddc0ae1e72866581b311aa03_find_suspect_kbs.ps1
# find_suspect_kbs.ps1 # MS14-045: Description of the security update for kernel-mode drivers: August 12, 2014 # http://support.microsoft.com/kb/2982791 # # http://blogs.technet.com/b/heyscriptingguy/archive/2011/08/22/use-powershell-to-easily-find-information-about-hotfixes.aspx gwmi -cl win32_reliabilityRec...
PowerShellCorpus/GithubGist/roberto-reale_86814193428f11601470_raw_60038f5305f924ce0dd0e9b4f453e558f08ae303_rename_files_iso8601.ps1
roberto-reale_86814193428f11601470_raw_60038f5305f924ce0dd0e9b4f453e558f08ae303_rename_files_iso8601.ps1
# # rename a bunch of files as follows # # DDMONYYYY_NAME.EXT ==> YYYY-MM-DD_NAME.EXT # # i.e. it changes the date to ISO 8601 form # # for each file in the local path Get-ChildItem -name |% { # old filename is in the form DDMONYYYY_NAME.EXT (e.g. 26APR1982_foobar.txt) $old_filename = $_; #...
PowerShellCorpus/GithubGist/victorvogelpoel_6683232_raw_666c9c83dd59b0473a773b1946475a919dee4adb_Test-PortalDeployment.ps1
victorvogelpoel_6683232_raw_666c9c83dd59b0473a773b1946475a919dee4adb_Test-PortalDeployment.ps1
# Test-PortalDeployment.ps1 # Written for SharePoint 2007, but with a few adaptations it'll work for later versions as well... # This is a example of testing SharePoint portal artefact deployment and configuration using PSaint testing framework # Victor Vogelpoel / Macaw (victor.vogelpoel@macaw.nl) # September 2013...
PowerShellCorpus/GithubGist/sneal_b006e5a8cbe50f04202a_raw_9989018c0cf57a0d71de4e63417bc3c93d352900_vagrant-shell.ps1
sneal_b006e5a8cbe50f04202a_raw_9989018c0cf57a0d71de4e63417bc3c93d352900_vagrant-shell.ps1
$command = "<%= options[:command] %>" + '; exit $LASTEXITCODE' $user = '<%= options[:username] %>' $password = '<%= options[:password] %>' $task_name = "WinRM_Elevated_Shell" $out_file = "$env:SystemRoot\Temp\WinRM_Elevated_Shell.log" if (Test-Path $out_file) { del $out_file } $task_xml = @' <?xml vers...
PowerShellCorpus/GithubGist/blart_7ee038e1799fe9293704_raw_92ced43527c4b7130ef857f4eb2d27419fc72975_check_sqlagent_jobs.ps1
blart_7ee038e1799fe9293704_raw_92ced43527c4b7130ef857f4eb2d27419fc72975_check_sqlagent_jobs.ps1
# SQL Agent Job Status - check_mk local plugin check. # Copyright 2014 Iomart Hosting Limited - coreservices@iomart.com. # Directions for use: # # Place in the check_mk plugin directory. # Edit the check_mk ini file to allow execution of ps1 powershell files. # Edit c:\program files (x86)\check_mk\sqlservers.t...
PowerShellCorpus/GithubGist/jesslilly_3c95849273d6220711d7_raw_0cc9833bd0a67edce08463a6cfba03369f4784e7_Microsoft.PowerShell_profile.ps1
jesslilly_3c95849273d6220711d7_raw_0cc9833bd0a67edce08463a6cfba03369f4784e7_Microsoft.PowerShell_profile.ps1
# # vi $profile # C:\Users\userid\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 # new-alias vi "C:\Program Files\Sublime Text 2\sublime_text.exe" new-alias grep select-string
PowerShellCorpus/GithubGist/GuruAnt_7216369_raw_61797328bac65e63d9df860f917d88509de51823_ManuallyCreateLinkedClonesInvSphere.ps1
GuruAnt_7216369_raw_61797328bac65e63d9df860f917d88509de51823_ManuallyCreateLinkedClonesInvSphere.ps1
# Script to deploy linked clones # List of custom attributes which you're wanting to copy from the template or parent to the newly created machine # (Machines deployed from templates no longer inherit CAs in vSphere 4.0) # These help us track provenance, and provide information to the user $arrStrAttributesToCopy...
PowerShellCorpus/GithubGist/mrdaemon_758948_raw_77e8522804f897f9d4a7dd31555309d5d45eb03d_hyperv-r2-configonly-import.ps1
mrdaemon_758948_raw_77e8522804f897f9d4a7dd31555309d5d45eb03d_hyperv-r2-configonly-import.ps1
<# .SYNOPSIS Safely Imports Hyper-V Virtual Machines that were exported as configuration only, without State Data (snapshots, VHDs, etc). .DESCRIPTION Hyper-V 2008 R2 removed the option to export a Virtual Machine without its State Data (Snapshots, Virtual Disk Images (VHDs), Suspend State), as co...
PowerShellCorpus/GithubGist/alienone_a464db9660fe65c8df9c_raw_4b26a1c4c27a75775fd92ea6556a3d254aa8aa11_get_stats.ps1
alienone_a464db9660fe65c8df9c_raw_4b26a1c4c27a75775fd92ea6556a3d254aa8aa11_get_stats.ps1
Function Get-ComputerStats { param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [string[]]$ComputerName ) process { foreach ($c in $ComputerName) { $avg = Get-WmiObject win32_processor -comput...
PowerShellCorpus/GithubGist/philipproplesch_5830384_raw_58475e8aef4e918d1fe43c11708902998082383b_SQLServerRebuildIndexes.ps1
philipproplesch_5830384_raw_58475e8aef4e918d1fe43c11708902998082383b_SQLServerRebuildIndexes.ps1
$serverName = "" $userName = "" $password = "" $maxFragmentation = 10 $databases = @("Sitecore_Core", "Sitecore_Master", "Sitecore_Web") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") $conn...
PowerShellCorpus/GithubGist/adefran83_8600591_raw_2f168607be5282a2796eccbd248a7c8c7c3333d3_rename.ps1
adefran83_8600591_raw_2f168607be5282a2796eccbd248a7c8c7c3333d3_rename.ps1
//Navigate to directory where files need to be renamed are Dir | Rename-Item –NewName { $_.name –replace “ “,”_” }
PowerShellCorpus/GithubGist/davideicardi_a8247230515177901e57_raw_7d126d5f1e5283306083dca6fe414bed4506b847_kuduSiteUpload.ps1
davideicardi_a8247230515177901e57_raw_7d126d5f1e5283306083dca6fe414bed4506b847_kuduSiteUpload.ps1
Param( [Parameter(Mandatory = $true)] [string]$websiteName, [Parameter(Mandatory = $true)] [string]$sourceDir, [string]$destinationPath = "/site/wwwroot" ) # Usage: .\kuduSiteUpload.ps1 -websiteName mySite -sourceDir C:\Temp\mydir Function d3-KuduUploadDirectory { param( ...
PowerShellCorpus/GithubGist/absolutejam_357efb1cc7f0e8b743b2_raw_340835f3a9fa8ee04660a37a4efa7a5e8cdba53c_reset-user-passwords.ps1
absolutejam_357efb1cc7f0e8b743b2_raw_340835f3a9fa8ee04660a37a4efa7a5e8cdba53c_reset-user-passwords.ps1
# ------------------------------------------------------------------------ # Edit these! $Password = 'apple' # The password you want to set $TargetOU = 'Test OU' # Apply to all users in this OU # You can use the * wildcard in $TargetOU # ----------------------------------------------------------...
PowerShellCorpus/GithubGist/yoshimov_3817081_raw_8c2ca7817f38e382ccc867c7538c4cc14598a40a_first-chocolatey.ps1
yoshimov_3817081_raw_8c2ca7817f38e382ccc867c7538c4cc14598a40a_first-chocolatey.ps1
# @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/gist/3817081/first-chocolatey.ps1'))" # install Chocolatey iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall')) # basic cinst vlc cinst 7zip cinst pdfcr...
PowerShellCorpus/GithubGist/stil_9299946_raw_632f0d5d1c162206e960532dd352838e53c2e882_backup.ps1
stil_9299946_raw_632f0d5d1c162206e960532dd352838e53c2e882_backup.ps1
# CONFIGURATION $dirToBackup = "C:\Users\John" # path to directory we back up (no following backslash) $outputDir = "E:\bak" # path directory we store our backups (no following backslash) $params = '-t7z', '-r', '-ms=off', '-mx1' # THE SCRIPT $fullBackup = $outputDir + "\full.7z" if (Test-Path ($fullBackup))...
PowerShellCorpus/GithubGist/phansch_3813881_raw_d856757192138cd212f1477e5bf9e13376aa92c5_GitHub.PowerShell_profile.ps1
phansch_3813881_raw_d856757192138cd212f1477e5bf9e13376aa92c5_GitHub.PowerShell_profile.ps1
function shorten-path([string] $path) { $loc = $path.Replace($HOME, '~') # remove prefix for UNC paths $loc = $loc -replace '^[^:]+::', '' # make path shorter like tabs in Vim, # handle paths starting with \\ and . correctly return ($loc -replace '\\(\.?)([^\\])[^\\]*(?=\\)','\$1$2') } ...
PowerShellCorpus/GithubGist/pepoluan_5832392_raw_19823bc99e52514a6db255a9046e0ba270fc67fc_Get-Ancestors.ps1
pepoluan_5832392_raw_19823bc99e52514a6db255a9046e0ba270fc67fc_Get-Ancestors.ps1
Function Get-Ancestors() { # The [switch] decorator allows specifying parameters as a flag param( $Identity, [switch]$Silent, [switch]$IncludeAllProperties ) # Initialize the hashtable and the .Net Queue $Ancestors = @{} $Queue = New-Object System.Collections.Queue...
PowerShellCorpus/GithubGist/n-fukuju_8487498_raw_cdd93509bdb2130315b812b9b2d80e20001b69d2_getfoldersize.ps1
n-fukuju_8487498_raw_cdd93509bdb2130315b812b9b2d80e20001b69d2_getfoldersize.ps1
# [int] カレントパスのフォルダサイズ (Get-ChildItem -Recurse -Force | Measure-Object -Sum Length).Sum # [string, int][] カレントパス配下に存在する各フォルダのサイズ Get-ChildItem | Select-Object Name,@{name="Size";expression={(Get-ChildItem $_.FullName -Recurse -Force | Measure-Object Length -Sum).Sum}}
PowerShellCorpus/GithubGist/cromwellryan_3383306_raw_ff1486584c1b541d6f78615cf622885718fa0f0e_host.ps1
cromwellryan_3383306_raw_ff1486584c1b541d6f78615cf622885718fa0f0e_host.ps1
function start-host($root) { $iisexpress = "$env:ProgramFiles\\IIS Express\\iisexpress.exe" if (!(test-path $iisexpress)) { write-error "Unable to locate IIS Express at $iisexpress" return } $approot = resolve-path $root write-host "Starting iisexpress at $approot" start $iisexpress ...
PowerShellCorpus/GithubGist/GuruAnt_7216184_raw_cda8a9f518d27d32997b99e0afd3c218c33e2dd2_getVCenterBuildNumbers.ps1
GuruAnt_7216184_raw_cda8a9f518d27d32997b99e0afd3c218c33e2dd2_getVCenterBuildNumbers.ps1
# Script to connect to a list of vCenter Servers, and get their version numbers, as well as the version numbers of their hosts # Ben Neise # 02/10/09 # Array of vCenter Servers $arrVCenterServers = @("server1","server2","server3") # Create empty arrays for the results $arrTableVCs = @() $arrTableHosts = @() ...
PowerShellCorpus/GithubGist/Mimieam_4942208_raw_1418af26522c6aff0810d196af604dd90d736238_Syncy.ps1
Mimieam_4942208_raw_1418af26522c6aff0810d196af604dd90d736238_Syncy.ps1
Unregister-Event FileDeleted Unregister-Event FileCreated Unregister-Event FileChanged [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon $contextMenu = New-Object System.Windows.Forms.ContextMenu $MenuI...
PowerShellCorpus/GithubGist/johannvs_5661056_raw_442d41adfefac723b8c5435843e396b97cfa073a_New-MailboxExport.ps1
johannvs_5661056_raw_442d41adfefac723b8c5435843e396b97cfa073a_New-MailboxExport.ps1
<# .SYNOPSIS New-MailboxExport.ps1 - Export an Exchange Mailbox to PST remotely. .DESCRIPTION Export an Exchange Mailbox to PST remotely instead of using the Exchange Management Shell. .PARAMETER RemoteExchangeServer FQDN of Exchange Server to where a PSSession will be established for the export request. ...
PowerShellCorpus/GithubGist/originalmind_3815479_raw_c2d498770fda9786146239d32dd68671f3852c76_gistfile1.ps1
originalmind_3815479_raw_c2d498770fda9786146239d32dd68671f3852c76_gistfile1.ps1
$webDeployArgs = '-verb:sync -retryAttempts:10 -retryInterval:2000 -source:runCommand="%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -inputformat none -file ' + $SERVER_INSTALL_PATH + 'srv_configure_staff_site.ps1",dontUseCommandExe=true,waitInterval=10000,waitAttempts=6 -dest:auto,computerName=' + $deplo...
PowerShellCorpus/GithubGist/briped_28603d3125e5fe72b99b_raw_2eba1e6bcbbbea3c469e49f57597eca2544485da_Move-ADGroupMembers.ps1
briped_28603d3125e5fe72b99b_raw_2eba1e6bcbbbea3c469e49f57597eca2544485da_Move-ADGroupMembers.ps1
Param( [parameter(Mandatory=$true, HelpMessage="Enter AD group to move from.")] [string] $SourceGroup, [parameter(Mandatory=$true, HelpMessage="Enter AD group to move to.")] [string] $TargetGroup ) Import-Module -Name ActiveDirectory -ErrorAction Silentl...
PowerShellCorpus/GithubGist/andrewgunn_b2958ff0c773b165a857_raw_fd067d2f29939b10f9778b1fd0f48dd2ce6a3ed1_Git.ps1
andrewgunn_b2958ff0c773b165a857_raw_fd067d2f29939b10f9778b1fd0f48dd2ce6a3ed1_Git.ps1
# Prerequisites # - Download https://github.com/downloads/anurse/git-credential-winstore/git-credential-winstore.exe and copy it to C:/Program Files (x86)/Git/libexec/git-core $name = read-host "Enter your name" $emailAddress = read-host "Enter your email address" git config --global core.autocrlf true git config...
PowerShellCorpus/GithubGist/orgimoto_5316573_raw_427eb405293fc9aa22f3bdd152d85beb5b16067b_Microsoft.PowerShell_profile.ps1
orgimoto_5316573_raw_427eb405293fc9aa22f3bdd152d85beb5b16067b_Microsoft.PowerShell_profile.ps1
#-- 設定値 --# $HistoryLogFile="${HOME}\AppFiles\Powershell\ps_history.xml" $MaximumHistoryCount = 10000 #-- 設定 --# Import-Clixml $HistoryLogFile | Add-History #-- 関数 --# function Save-History{ Get-History -Count $MaximumHistoryCount | Export-Clixml ${HistoryLogFile} } function e{ Save-History exit }...
PowerShellCorpus/GithubGist/breezhang_4544015_raw_c6aa6e6b8874d9cafc6e61369150be0f79adcf41_get_set_.ps1
breezhang_4544015_raw_c6aa6e6b8874d9cafc6e61369150be0f79adcf41_get_set_.ps1
${c:\a.file} = 12345 # set ${c:\a.file} = "" #empty ${c:\a.file} +="file" #apply ${c:\a.file} = ${c:\b.file} #copy file
PowerShellCorpus/GithubGist/wiking-at_a276d32211bb8228fe08_raw_0546cc6dbc0982f76fe977da91118042f5865adf_db-migration.ps1
wiking-at_a276d32211bb8228fe08_raw_0546cc6dbc0982f76fe977da91118042f5865adf_db-migration.ps1
Function Get-IniContent { <# .Synopsis Gets the content of an INI file .Description Gets the content of an INI file and returns it as a hashtable .Notes Author : Oliver Lipkau <oliver@lipkau.net> Blog : http://oliver.lipkau....
PowerShellCorpus/GithubGist/belotn_4986539_raw_cc4a6989f605a99eebe7cd2d25b8a03c07b25c1f_move-datastore.ps1
belotn_4986539_raw_cc4a6989f605a99eebe7cd2d25b8a03c07b25c1f_move-datastore.ps1
$username ="MyUser" $password="MyPwd" $dsnfilename="Path/to/my/newdsn" Get-xaserver |% { $serverName = $_.servername $servername get-content New.dsn |%{ if ($_ -like '*WSID*') {"WSID=$servername" }else{$_} } | out-file "\\$($_.ServerNAme)\c$\Path\to\newdsn" $command = "cmd /c dsmaint config /user:$us...
PowerShellCorpus/GithubGist/VoidVolker_f67765e7eaf0b898bdc6_raw_53e94eaf29fb044b51f52cffec3031cfe62eef02_powershell%20ftp%20http%20get%20unzip%20get-unzip.ps1
VoidVolker_f67765e7eaf0b898bdc6_raw_53e94eaf29fb044b51f52cffec3031cfe62eef02_powershell%20ftp%20http%20get%20unzip%20get-unzip.ps1
# Download the file to a specific location # get-unzip.ps1 "ftp://path/filename" "C:\path" "filename" $clnt = new-object System.Net.WebClient $url = $args[0] $folder = $args[1] $file = $args[2] $path = $($args[1]+"\"+$args[2]) $clnt.DownloadFile($url,$path) # Unzip the file to specified location $shell_app=n...
PowerShellCorpus/GithubGist/pothedar_a295cbc9949d23d2b06b_raw_2b3e57ea2c1c23f02105b589f7bbf1ac277ec43a_InstallPackages.ps1
pothedar_a295cbc9949d23d2b06b_raw_2b3e57ea2c1c23f02105b589f7bbf1ac277ec43a_InstallPackages.ps1
param( [string] $SQLpass=$null, [string] $p4port=$null, [string] $p4user=$null, [string] $P4pass=$null ) # Boxstarter options # commenting these options since auto reboot is fickle and was found to run in loops #$Boxstarter.RebootOk=$false # Allow reboots #$Boxstarter.NoPassword=$false # Is this a machine...
PowerShellCorpus/GithubGist/AbraaoAlves_1779808_raw_df3d46ce9e93d58c439d7b001d2fe22955954a85_GitForPS1.ps1
AbraaoAlves_1779808_raw_df3d46ce9e93d58c439d7b001d2fe22955954a85_GitForPS1.ps1
#Com git instalado, via powershell: #antes de executar o ps1: Set-ExecutionPolicy Unrestricted | responder S if(!$env:path.Contains("C:\Program Files (x86)\Git\bin")) { $env:path += ";C:\Program Files (x86)\Git\bin"; } if(!$env:path.Contains("C:\Program Files (x86)\Git\cmd")) { $env:path += ";C:\Program Files (...
PowerShellCorpus/GithubGist/VertigoRay_6357306_raw_5331c85c3841c481b2a5b8c30d7844318b71f090_SearchAcrossMultipleDomainsInForest.FindAll.ps1
VertigoRay_6357306_raw_5331c85c3841c481b2a5b8c30d7844318b71f090_SearchAcrossMultipleDomainsInForest.FindAll.ps1
try { foreach ($res in $Search.FindAll()) { $User = $res.GetDirectoryEntry() $NewObject = New-Object PSObject Add-Member -InputObject $NewObject NoteProperty 'DistinguishedName' $User.DistinguishedName Add-Member -InputObject $NewObject NoteProperty 'SamAccountName' $User.SamAccountName $OutputL...
PowerShellCorpus/GithubGist/jpoul_1819706b6b157515be18_raw_32587b34fb0251b3066b21f4064211c64d720bc8_boxstarter.dev.spd.ps1
jpoul_1819706b6b157515be18_raw_32587b34fb0251b3066b21f4064211c64d720bc8_boxstarter.dev.spd.ps1
Set-ExecutionPolicy -ExecutionPolicy Bypass -Confirm:$false Disable-InternetExplorerESC Enable-RemoteDesktop Set-TaskbarOptions -UnLock $false Set-CornerNavigationOptions -EnableUsePowerShellOnWinX Set-StartScreenOptions -EnableBootToDesktop -EnableListDesktopAppsFirst -EnableDesktopBackgroundOnStart Set-WindowsE...