full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/momcms_MoM.Dev/install.ps1 | install.ps1 | $ErrorActionPreference = "Stop"
function CloneOrPullRepository([string] $name)
{
try
{
$GitFolder = $(get-location).Path +"\" + $name + "\.git";
$AllreadyCloned = Test-Path ($GitFolder);
if($AllreadyCloned)
{
Write-Host "Updating" $name;
cd $na... |
PowerShellCorpus/Github/momcms_MoM.Dev/migrations.ps1 | migrations.ps1 | |
PowerShellCorpus/Github/momcms_MoM.Dev/build.ps1 | build.ps1 | $ErrorActionPreference = "Stop"
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
{
while($true)
{
try
{
Invoke-WebRequest $url -OutFile $downloadLocation
break
}
catch
{
$exceptionMess... |
PowerShellCorpus/Github/mharrison0224_deploy-azureresourcesasr/InstallADDS.ps1 | InstallADDS.ps1 | Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools -Restart
$NewDisk = Get-Disk | Where-Object PartitionStyle -eq "RAW"
Initialize-Disk -Number $NewDisk.Number
New-Partition -DiskNumber $NewDisk.Number -DriveLetter N -UseMaximumSize
Format-Volume -DriveLetter N -Confirm:$false -Force
|
PowerShellCorpus/Github/elvith-de_PowerShell-Tools/Get-31C3Talks.ps1 | Get-31C3Talks.ps1 | <#
Code-Snippet to download all (published) 31C3 recordings with Windows Powershell
Script will download the talks using BITS. Download will only use free bandwidth
and shouldn't therefore interfere with the stream, etc.
Hint: Schedule script in the task scheduler to download newly published talks
Prerequisi... |
PowerShellCorpus/Github/elvith-de_PowerShell-Tools/Copy-BackupDelta.ps1 | Copy-BackupDelta.ps1 | <#
.SYNOPSIS
<A brief description of the script>
.DESCRIPTION
<A detailed description of the script>
.PARAMETER <paramName>
<Description of script parameter>
.EXAMPLE
<An example of using the script>
#>
function Copy-BackupDelta{
[Cmdletbinding()]
param(
[Parameter(Mandatory=$true)]
[... |
PowerShellCorpus/Github/elvith-de_PowerShell-Tools/Format-ImagesForGallery.ps1 | Format-ImagesForGallery.ps1 | <#
.SYNOPSIS
Helper function to resize (and rename, if some specific characters are used) ALL images in a folder to prepare
them before uploading them into a gallery
!!Requires ImageMagick to be installed!!
.DESCRIPTION
ä, ö, ü and ß in the filename will be replaced
images will be resized to h... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/jQuery.1.10.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Determine the file paths
$projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName
$origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName
if (Test-Path $projectIntelliSense... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/jQuery.1.10.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# VS 11 and above supports the new intellisense JS files
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/jQuery.1.10.2/Tools/common.ps1 | common.ps1 | function Get-Checksum($file) {
$cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
$fileInfo = Get-Item $file
trap { ;
continue } $stream = $fileInfo.OpenRead()
if ($? -eq $false) {
# Couldn't open file for reading
return $null
}
$bytes = $... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/Modernizr.2.6.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/Modernizr.2.6.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileName... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/Modernizr.2.6.2/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/EntityFramework.6.1.3/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
if (Get-Module | ?{ $_.Name -eq 'EntityFramework' })
{
Remove-Module EntityFramework
}
Import-Module (Join-Path $toolsPath EntityFramework.psd1)
# SIG # Begin signature block
# MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQ... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/EntityFramework.6.1.3/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
Initialize-EFConfiguration $project
Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
Write-Host
Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework comma... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/CLIENTVIDEO/packages/Newtonsoft.Json.6.0.4/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://james.newtonking.com/json"
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Con... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/SERVICEVIDEO/packages/EntityFramework.5.0.0/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
$importedModule = Get-Module | ?{ $_.Name -eq 'EntityFramework' }
if ($PSVersionTable.PSVersion -ge (New-Object Version @( 3, 0 )))
{
$thisModuleManifest = 'EntityFramework.PS3.psd1'
}
else
{
$thisModuleManifest = 'EntityFramework.psd1'
}
$thisModule... |
PowerShellCorpus/Github/DIALLOIMRAN_movie-store/SERVICEVIDEO/packages/EntityFramework.5.0.0/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
function Invoke-ConnectionFactoryConfigurator($assemblyPath, $project)
{
$appDomain = [AppDomain]::CreateDomain(
'EntityFramework.PowerShell',
$null,
(New-Object System.AppDomainSetup -Property @{ ShadowCopyFiles = 'true' }))
... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/Modernizr.2.6.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/Modernizr.2.6.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileName... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/Modernizr.2.6.2/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/EntityFramework.5.0.0/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
$importedModule = Get-Module | ?{ $_.Name -eq 'EntityFramework' }
if ($PSVersionTable.PSVersion -ge (New-Object Version @( 3, 0 )))
{
$thisModuleManifest = 'EntityFramework.PS3.psd1'
}
else
{
$thisModuleManifest = 'EntityFramework.psd1'
}
$thisModule... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/EntityFramework.5.0.0/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
function Invoke-ConnectionFactoryConfigurator($assemblyPath, $project)
{
$appDomain = [AppDomain]::CreateDomain(
'EntityFramework.PowerShell',
$null,
(New-Object System.AppDomainSetup -Property @{ ShadowCopyFiles = 'true' }))
... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/jQuery.UI.Combined.1.8.24/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $juiFileNameRegEx |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/jQuery.UI.Combined.1.8.24/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $juiFileNameRegEx ... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/jQuery.UI.Combined.1.8.24/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/jQuery.1.8.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Determine the file paths
$projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName
$origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName
if (Test-Path $projectIntelliSense... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/jQuery.1.8.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# VS 11 and above supports the new intellisense JS files
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/rpinheiro_Laboratorio/LabVet/packages/jQuery.1.8.2/Tools/common.ps1 | common.ps1 | function Get-Checksum($file) {
$cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
$fileInfo = Get-Item $file
trap { ;
continue } $stream = $fileInfo.OpenRead()
if ($? -eq $false) {
# Couldn't open file for reading
return $null
}
$bytes = $... |
PowerShellCorpus/Github/OPSTest_E2E_Provision_1488852343804/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/SacCounty_junar-dotnet-uploader/Properties/PublishProfiles/JunarUpload-publish.ps1 | JunarUpload-publish.ps1 | [cmdletbinding(SupportsShouldProcess=$true)]
param($publishProperties=@{}, $packOutput, $pubProfilePath)
# to learn more about this file visit https://go.microsoft.com/fwlink/?LinkId=524327
try{
if ($publishProperties['ProjectGuid'] -eq $null){
$publishProperties['ProjectGuid'] = '577a2a44-dd67-4db... |
PowerShellCorpus/Github/LawrenceHwang_PowerShellSummit2017/PushCFN.ps1 | PushCFN.ps1 | Initialize-AWSDefaults -ProfileName myaws
Set-DefaultAWSRegion -Region 'us-west-2'
$Template = "$env:USERPROFILE\OneDrive\Code\github\PowerShellSummit2017\EC2.json"
$TemplateBody = get-content -Path $Template -Raw
Test-CFNTemplate -TemplateBody $TemplateBody -OutVariable cfn
$ImageId = Get-EC2ImageByName -Name... |
PowerShellCorpus/Github/LawrenceHwang_PowerShellSummit2017/PuchCFN.test.ps1 | PuchCFN.test.ps1 | [CmdletBinding()]
param(
[string]$CfnStackName
)
Initialize-AWSDefaults -ProfileName myaws
Set-DefaultAWSRegion 'us-west-2'
$stack = Get-CFNStack -StackName $CfnStackName
$SecurityGroup = Get-EC2SecurityGroup -filter @(@{name = 'tag:aws:cloudformation:stack-id'; values = $Stack.StackId})
$instance = get-ec2in... |
PowerShellCorpus/Github/tweeks024_AD-Scripts/AD-DisableAccounts-EE_ID.ps1 | AD-DisableAccounts-EE_ID.ps1 | #
# Script Name: AD-DisableAccounts-EE_ID.ps1
#
# Author: Tom Weeks
# Email: tom.m.weeks@gmail.com
# Date: 8.11.2014
##### MAIN #####
# Get users and Employee ID from csv and filter based on EmployeeID. Disable all users that match.
Import-Module activedirectory
$list = Import-CSV c:\scripts\disa... |
PowerShellCorpus/Github/tweeks024_AD-Scripts/AD-DisableComputerAccounts.ps1 | AD-DisableComputerAccounts.ps1 | #
# Script Name: AD-DisableComputerAccounts.ps1
#
# Author: Tom Weeks
# Email: tom.m.weeks@gmail.com
# Date: 11.17.2014
##### MAIN #####
# Get workstations and servers from csv files, move object, and disable
Import-Module activedirectory
$workstations = Import-CSV c:\scripts\workstations.csv
f... |
PowerShellCorpus/Github/tweeks024_AD-Scripts/AD-MoveComputers.ps1 | AD-MoveComputers.ps1 | #
# Script Name: AD-MoveComputers.ps1
#
# Author: Tom Weeks
# Email: tom.m.weeks@gmail.com
# Date: 7.8.2015
##### MAIN #####
# Get all computers in Computers CN. Uses OperatingSystem property to determine location. Adds any server OS to "Server Policy Universal" AD Group unless name contains Group1 or... |
PowerShellCorpus/Github/tweeks024_AD-Scripts/AD-DNSReplaceRecords.ps1 | AD-DNSReplaceRecords.ps1 | #
# Script Name: AD-DNSReplaceRecords.ps1
#
# Author: Tom Weeks
# Email: tom.m.weeks@gmail.com
# Date: 4.5.2013
##### MAIN #####
# Get new DNS records from csv file and replace old records with them. Replicate changes throughout domain. Used during Disaster Recovery events after Zerto failover.
... |
PowerShellCorpus/Github/tweeks024_AD-Scripts/AD-Set-Attribute.ps1 | AD-Set-Attribute.ps1 | #
# Script Name: AD-Set-Attribute.ps1
#
# Author: Tom Weeks
# Email: tom.m.weeks@gmail.com
# Date: 8.12.2011
##### MAIN #####
# Import users from csv and update extensionAttribute15 from values in csv.
$userlist = Import-CSV c:\scripts\users.csv
foreach ($item in $userlist) {
$display = $item... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-cpu.ps1 | function-show-cpu.ps1 | # ----------------------------------------------------------------------
# Function: cpu - show cpu usage on remote server.
#
# Repeat for specified number of times, with a specified delay
# between samples. Or just do it once, straightaway
#
# This function is autoloaded by .matt.ps1
# ---... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-serversize.ps1 | function-show-serversize.ps1 | function get-serversize {
<#
.SYNOPSIS
Gets drive sizings
.DESCRIPTION
This function is autoloaded by .matt.ps1
#>
[CmdletBinding()]
Param( $ComputerName)
foreach ($C in $ComputerName)
{
Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer $C
}
}
set-alias gs get-serversize... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-convertto-twiki.ps1 | function-convertto-twiki.ps1 | function convertto-twiki {
<#
.SYNOPSIS
Reformats an object inna twiki-style
.DESCRIPTION
Pushes the object through convertto-html then does a bunch of search and replaces
.PARAMETER InputObject
.INPUTS
None. You cannot pipe objects to this function
.EXAMPLE
.EXAMPLE
.LINK
Twiki list... |
PowerShellCorpus/Github/mattypenny_posh_functions/select-FullName.Tests.ps1 | select-FullName.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "select-FullName" {
$PesterData = "c:\powershell\functions\PesterData"
It "displays the fullname for a single specified file" {
select-... |
PowerShellCorpus/Github/mattypenny_posh_functions/bundle-oneliners.ps1 | bundle-oneliners.ps1 | # ----------------------------------------------------------------------
# These functions are too titchy to have their own separate ps1 file
#
# Some are glorified aliases
#
# This will be autoloaded by .matt.ps1
# ----------------------------------------------------------------------
function dirod {
<#
.S... |
PowerShellCorpus/Github/mattypenny_posh_functions/get-duplicates.ps1 | get-duplicates.ps1 |
function get-duplicates
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$True,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True,
HelpMessage='What folder(s) would you like to target?')]
[string[]]$folders,
[string]$check_method = 'S'
)
functio... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-loggedonuser.ps1 | function-show-loggedonuser.ps1 | function get-loggedonuser {
<#
.SYNOPSIS
Gets users logged on to a PC or server
.DESCRIPTION
Gets users logged on to a PC or server
This function is autoloaded by .matt.ps1
.PARAMETER $ComputerName
Can be a single PC or a list of PCs
.INPUTS
None. You cannot pipe objects to this function
.... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-qr.ps1 | function-qr.ps1 | $QuickReferenceFolder = "c:\users\$($($Env:Username).trimend('2'))\Documents\QuickReference\"
function get-LineFromQuickReferenceFiles {
<#
.SYNOPSIS
Does a grep on quickref files
.DESCRIPTION
This function is autoloaded by .matt.ps1
.PARAMETER $Pattern
What to grep for. e.g. databases
.INPUTS
None. You c... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-import-mtpModule.ps1 | function-import-mtpModule.ps1 | function import-mtpModule {
<#
.SYNOPSIS
Shows module last update time, removes it if its already loaded then imports it
.DESCRIPTION
Shows module last update time, removes it if its already loaded then imports it
This function is autoloaded by .matt.ps1
.PARAMETER ModuleName
List of Modules to l... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-timeandprocesses.ps1 | function-show-timeandprocesses.ps1 | # ----------------------------------------------------------------------
# Function: tp - show time, then process info
# ----------------------------------------------------------------------
function show-timeandprocesses {
Param ([String] $MyServer, [String] $MyProcessString)
get-date -format F
get-process ... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-proc.ps1 | function-show-proc.ps1 | # ----------------------------------------------------------------------
# Function: sproc - show processor details. Runs get-wmiobject
# win32_processor
# ----------------------------------------------------------------------
function show-proc {
Param ( [String] $MyServer = ".")
Get-WmiObject win3... |
PowerShellCorpus/Github/mattypenny_posh_functions/working_on_multi_column_print.ps1 | working_on_multi_column_print.ps1 | $val=0; $Aliases = while ($val -ne 5) {$val++; New-Object -TypeName PSObject -property @{Name = "$val"; Definition ="Defined"}}
$DesiredColumns = 3
[int]$AliasesWritten = 0
# $Aliases
[int]$CountOfAliases = $($Aliases | measure-object).count
write-debug "`$CountOfAliases: $CountOfAliases... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-fullname.ps1 | function-get-fullname.ps1 | function get-fullname {
<#
.SYNOPSIS
Accepts item input from the commandline and outputs lastwritetime and fullname
.DESCRIPTION
Just a handy select function
This function is autoloaded by .matt.ps1
.PARAMETER From the pipe line
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
... |
PowerShellCorpus/Github/mattypenny_posh_functions/get-childitembydate.ps1 | get-childitembydate.ps1 | <#
.Synopsis
Short description
.DESCRIPTION
Long description
This function is autoloaded by .matt.ps1
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
function get-childitembydate
{
[CmdletBinding()]
Param
(
# P... |
PowerShellCorpus/Github/mattypenny_posh_functions/get-contentfromlastfile.ps1 | get-contentfromlastfile.ps1 | function get-ContentFromLastFile {
<#
.SYNOPSIS
Show content of last file for filespec
.DESCRIPTION
Longer description
This function is autoloaded by .matt.ps1
.PARAMETER
Filespec e.g. c:\temp\*.log
.EXAMPLE
get-contentfromlastfile c:\temp\*.log
#>
[CmdletBinding()]
Param(... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-os.ps1 | function-show-os.ps1 |
function get-os
{
<#
.SYNOPSIS
Get OS details for specified computer
.DESCRIPTION
This function is autoloaded by .matt.ps1
#>
[CmdletBinding()]
Param ( [Parameter(Position=1)]$ComputerNameList = ".")
foreach ($ComputerName in $ComputerNameList)
{
get-wmiobject -class win32_operatings... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-mp3tags.ps1 | function-get-mp3tags.ps1 | <#
.Synopsis
Short description
.DESCRIPTION
This code is based on Shaun Cassells Get-Mp3FilesLessThan which I found at:
http://myitforum.com/myitforumwp/2012/07/24/music-library-cleaning-with-powershell-identifying-old-mp3-files-with-low-bitrates/
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-pins.ps1 | function-get-pins.ps1 | <#
.Synopsis
Gets pins (i.e. saved URLs) from Pinboard
.DESCRIPTION
Gets pins (i.e. saved URLs) from Pinboard
Todo: option parameter
Todo: tags parameter
.PARAMETER Username
Pinboard user. If the $PinUser variable has been defined, this will be used as a default
.PARAMETER Password
Pinboard ... |
PowerShellCorpus/Github/mattypenny_posh_functions/get-FullName.ps1 | get-FullName.ps1 | function get-fullname {
<#
.SYNOPSIS
Accepts item input from the commandline and outputs lastwritetime and fullname
.DESCRIPTION
Just a handy select function
This function is autoloaded by .matt.ps1
.PARAMETER From the pipe line
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-sqlenv.ps1 | function-sqlenv.ps1 | <#
.Synopsis
Sets $ServerInstance and $ComputerName
.DESCRIPTION
This function sets $ServerInstance and $ComputerName. It's an equivalent of .oraenv
This function is autoloaded by .matt.ps1
Todo: Could append \default if appropriate
.EXAMPLE
. sqlenv
PS C:\Windows\system32> . sqlenv
... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-sqlsessions.ps1 | function-get-sqlsessions.ps1 | function get-sqlsessions {
<#
.SYNOPSIS
Gets sql sessions
.DESCRIPTION
sql sessions
This function is autoloaded by .matt.ps1
.PARAMETER $ServerInstance
Can be a single server or a list of server
.INPUTS
None. You cannot pipe objects to this function
.EXAMPLE
get-sqlsessions sql01
.LI... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-vidate.ps1 | function-vidate.ps1 | # ----------------------------------------------------------------------
# Function: vidate - edit-filewithbackup
#
# This function copies the existing file to old\<filename>_<date>
# This function is autoloaded
# ----------------------------------------------------------------------
function ... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-template.ps1 | function-template.ps1 | function get-template {
<#
.SYNOPSIS
One-line description
.DESCRIPTION
Longer description
.PARAMETER
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
[CmdletBinding()]
Param( [string][Alias ("f")]$folder = "$pwd" )
write-... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-alias.ps1 | function-show-alias.ps1 | function show-alias {
<#
.SYNOPSIS
Displays a list of all the aliases which aren't built in.
.DESCRIPTION
Basically pipes get-alias into a comparison with a big long hard-coded list
of built in aliases
.PARAMETER No parameters
No parameters
.INPUTS
None. You cannot pipe objects to this function
.EXA... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-about_topics.ps1 | function-about_topics.ps1 | function blank-template {
<#
.SYNOPSIS
One-line description
.DESCRIPTION
Longer description
.PARAMETER
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
write-output "This is an intentionally useless function, that just serves to serve the ... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-scripts.ps1 | function-show-scripts.ps1 | function get-scripts {
<#
.SYNOPSIS
Show the ps1 scripts in the script folders
.DESCRIPTION
Just a convenience for showing the scripts
This function is autoloaded by .matt.ps1
.PARAMETER Folders
This would nearly always be left to the default, which would be set in the $profile, or '.matt' initial... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-sqlserverjobs.ps1 | function-get-sqlserverjobs.ps1 | function get-sqlserverjobs {
<#
.SYNOPSIS
This function gets sqlserver jobs for a given sqlserver
.DESCRIPTION
Uses the sqlserver PSDrive to show sql agent jobs
To do:
- a switch to not do the refresh
- a switch to report all sqlservers in a list
This function is autoloaded by .matt.ps1
.PARAMETER ... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-history.ps1 | function-show-history.ps1 | # ------------------------------
# show-history
# These functions are autoloaded
# ------------------------------
<#
.Synopsis
Gets the history
.DESCRIPTION
Gets history - 1000
searches for specified string
This function is autoloaded by .matt.ps1
.EXAMPLE
.EXAMPLE
Another example of how... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-nonstandardservices.ps1 | function-get-nonstandardservices.ps1 | function get-nonstandardservices {
<#
.SYNOPSIS
Gets a list of services deemed as non-standard or 'distinctive'
.DESCRIPTION
This function is autoloaded by .matt.ps1
.PARAMETER ComputerNameList
List of Computers, or just one
#>
[CmdletBinding()]
Param ($ComputerNameList = ".")
write-debug "... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-prompt.ps1 | function-prompt.ps1 | function prompt {
<#
.SYNOPSIS
Sets the prompt
.DESCRIPTION
Sets the prompt either:
- the GitShell prompt, but with only the last element of the folder name or
- the get-date
...depending on whether I'm in the Git Shell or not
Todo: show the time
Todo: show the time of the last command
This function i... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-getinstanceinformation.ps1 | function-getinstanceinformation.ps1 | function get-instanceinformation {
<#
.SYNOPSIS
Gets information about the instance and the server it lives on
.DESCRIPTION
Developed to provide information for a third party, but possibly useful otherwise
.PARAMETER ServerInstance
Instance name
.EXAMPLE
Example of how to use this cmdlet
#>
... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-foldersize.ps1 | function-show-foldersize.ps1 | function show-foldersize {
<#
.SYNOPSIS
Recursively gets size of folders (but doesn't accumulate) [SH]
.DESCRIPTION
Lightly modified from http://technet.microsoft.com/en-us/library/ff730945.aspx
.PARAMETER BaseDirectory
.INPUTS
None. You cannot pipe objects to this function
.EXAMPLE
.EXAM... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-cal.ps1 | function-get-cal.ps1 | # ----------------------------------------------------------------------
# Function: aliasname -
#
# This function
# ----------------------------------------------------------------------
function get-cal {
<#
.SYNOPSIS
Similar to the Unix Cal Command ( Get-Cal.ps1 ). Lightly tweaked version of a ac... |
PowerShellCorpus/Github/mattypenny_posh_functions/select-FullName.ps1 | select-FullName.ps1 | function select-FullName {
Param (
[Parameter(Mandatory=$False,ValueFromPipeLine=$true, Position=1)][String]$filename = "."
)
foreach ($i in $input)
{
$I | select fullname
}
<#
if ($input)
{
foreach ($i in $input)
{
$filename = $i
$Child... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-WordpressContent.ps1 | function-get-WordpressContent.ps1 |
function convert-wpToHugo{
<#
.SYNOPSIS
One-line description
.DESCRIPTION
Longer description
.PARAMETER WordpressXML
The wordpress content imported into an xml variable
.PARAMETER PostString
The wordpress content imported into an xml variable
.PARAMETER PostType
The type as returned fro... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-sql.ps1 | function-sql.ps1 | # ----------------------------------------------------------------------
# Function: sql - Run a query against a specified database
# This function is autoloaded by .matt.ps1
# ----------------------------------------------------------------------
function run-sql { Param ( [String] $ServerInstance, [String] $Que... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-backups.ps1 | function-show-backups.ps1 | # ----------------------------------------------------------------------
# Function: sbackup - sqlserver backups
#
# These functions show backups for the specified instance
# This function is autoloaded
# ----------------------------------------------------------------------
function show-back... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-sqlsize.ps1 | function-show-sqlsize.ps1 | # ----------------------------------------------------------------------
# Function: sss - Show database sizings
# These functions are autoloaded
# ----------------------------------------------------------------------
function show-sqlsize { Param( [String] $MyServer)
invoke-sqlcmd -ServerInstance $MyServer -quer... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-childitembydate.ps1 | function-get-childitembydate.ps1 | <#
.Synopsis
Get files modified between specified dates [sh]
.DESCRIPTION
This was either an example from some learning exercise or it was for some very specific purpose that I've forgotten.
It's a possible candidate for moving out of the 'automatically loaded' area
.EXAMPLE
get-childitembydate "*txt" 20 ... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-toplevelfolders.ps1 | function-get-toplevelfolders.ps1 | function get-toplevelfolders {
<#
.SYNOPSIS
Get servers top level folders
.DESCRIPTION
Handy for looking to see where stuff is installed.
This function is autoloaded by .matt.ps1
.PARAMETER
.EXAMPLE
get-toplevelfolders server1
.EXAMPLE
gtlf server1 | select fullname
#>
[CmdletBinding... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-functions.ps1 | function-show-functions.ps1 | # ------------------------------
# show-functions
# ------------------------------
function get-functions {
<#
.SYNOPSIS
Show the functions in the repository folder
.DESCRIPTION
This function is autoloaded by .matt.ps1
#>
$SHOW_FUNCTIONS_OBJECT = gci \\$RepositoryServer\d$\dbawork\matt\functions\*.ps1,$GhFu... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-set-debug.ps1 | function-set-debug.ps1 | # ----------------------------------------------------------------------
# Function: aliasname - dbgon/off
#
# This function just sets debug off (default) or on
# ----------------------------------------------------------------------
function set-debug {
<#
.SYNOPSIS
Sets de bugger on or off
.DESC... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-show-serverinfo.ps1 | function-show-serverinfo.ps1 | # ----------------------------------------------------------------------
# Function: ssi - show all static OS info
#
# Show lots of OS stuff
#
# This function is autoloaded by .matt.ps1
# ----------------------------------------------------------------------
function show-serverinfo {
Param ( [Stri... |
PowerShellCorpus/Github/mattypenny_posh_functions/script-TabCompletion-TestName.ps1 | script-TabCompletion-TestName.ps1 | $Completion_TestName = {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$DescribeLines = select-string "^Describe `"*`"*`{*" *.Tests.ps1 | sort-object -Property Line
$PesterTests = foreach ($Line in $DescribeLines)
{
$TestDescription = $Line.li... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-template-commentbasedhelp.ps1 | function-template-commentbasedhelp.ps1 | <#
.SYNOPSIS
[sh]
.DESCRIPTION
.PARAMETER
.INPUTS
None. You cannot pipe objects to this function
.EXAMPLE
.EXAMPLE
#>
|
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-topprocesses.ps1 | function-get-topprocesses.ps1 | function get-topprocesses {
<#
.SYNOPSIS
Gets top windows processes on specified server
.DESCRIPTION
Longer description
This function is autoloaded by .matt.ps1
.PARAMETER ComputerName
.PARAMETER NumberOfProcesses
.EXAMPLE
top server1
.EXAMPLE
Another example of how to use this cmdl... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-sqlping.ps1 | function-sqlping.ps1 | # ----------------------------------------------------------------------
# Function: sqlping - Connect to specified sqlserver and show version
# This function is autoloaded
# ----------------------------------------------------------------------
function sqlping {
[System.ComponentModel.Description("Connects an... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-childitemwithcommas.ps1 | function-get-childitemwithcommas.ps1 | function get-childitemwithcommas {
<#
.SYNOPSIS
Does a dir, but outputs length with commas
.DESCRIPTION
Longer description
This function is autoloaded by .matt.ps1
.PARAMETER
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
[Cmdle... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-save-history.ps1 | function-save-history.ps1 | # ------------------------------
# save-history
# ------------------------------
function save-history {
<#
.Synopsis
Saves history to \\$RepositoryServer\d$\dbawork\matt\history\history.txt
This function is autoloaded by .matt.ps1
#>
$folder = "c:\powershell\history\"
foreach ($H in $(... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-gitaddcommand.ps1 | function-get-gitaddcommand.ps1 | <#
.Synopsis
Generates a 'git add' command for everything that has been changed but not added
.DESCRIPTION
Generates a 'git add' command for everything that has been changed but not added.
There's probably a better way to do this within git itself, but I couldn't find it!
Todo: implement swapping ... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-get-MtpEventLog.ps1 | function-get-MtpEventLog.ps1 | get-MTPEventLog {
<#
.SYNOPSIS
Displays the eventlog a bit more prettier than get-eventlog does out of the box
.DESCRIPTION
As above
This function is autoloaded by .matt.ps1
.PARAMETER ComputerName
Specify the remote server. If null tells you about wherever you are running
.PARAMETER StartTime
StartTim... |
PowerShellCorpus/Github/mattypenny_posh_functions/function-add-TocToHtml.ps1 | function-add-TocToHtml.ps1 | function add-TocToHtml {
<#
.SYNOPSIS
Reads in an html page, writes out an html page with a table of contents
.DESCRIPTION
Todo list
Todo: parameterize what headings are toc-ed
Todo: make it work with headings other than <h3>
Todo: indent the toc depending on the heading level
Todo: create t... |
PowerShellCorpus/Github/ader1990_heat-powershell-utils/Tests/heat-powershell-utils.tests.ps1 | heat-powershell-utils.tests.ps1 | #ps1_sysnative
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
PowerShellCorpus/Github/AliumFX_Module-Security/build.ps1 | build.ps1 | # Step into build-template directory and invoke the build script.
Set-Location .\build-template
Invoke-Expression -Command .\build.ps1 |
PowerShellCorpus/Github/v-peliao_E2E_Test1qd.he-il/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Remote Control.ps1 | Remote Control.ps1 | # Work script on working with remote control functions, and also multitasking and job
# related functions.
#
# M. Cockrum 2/17/2016
#
# To start Remoting on the Remote Machine
Enable-PSRemoting
# Read the below help on enabling remoting via group policy
help about_Remote_Troubleshooting
# One-to-On... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Objects and Pipes.ps1 | Objects and Pipes.ps1 | # Work script on basic information working with objects and pipes
#
# M. Cockrum 2/17/2016
#
# * Information Retrival Commands - Getting .NET Object members/functions/properties *
Get-Command more | Get-Member
Get-Date | Get-Member
# Powershell output is always an object (including an array of objects).
... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Active Directory Module.ps1 | Active Directory Module.ps1 | # Work script on Active Directory Commands
#
# M. Cockrum 2/6/2016
#
Set-PSDebug -Strict
# Note: This requires the Active Diretory module for PS Feature found under
# RSAT -> Role Admin -> AD DS and AD LSDS Tools
import-module activedirectory
# List the modules available using this
Get-Module -list... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Basic Cmdlets 1.ps1 | Basic Cmdlets 1.ps1 | # Work script on basic information gathering cmdlets
#
# M. Cockrum 2/6/2016
#
Set-PSDebug -Strict
# To resolve the dreaded "execution of scripts is disabled" message.
get-help set-executionPolicy -detailed
set-executionpolicy -executionpolicy unrestricted
# * Map the P:\ Drive to the PowerShell Command... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Arrays.ps1 | Arrays.ps1 | # Tutorial work script on arrays and how they pipe
#
# M. Cockrum 2/6/2016
#
Set-PSDebug -Strict
# List all comparison operators using the following command:
# help about_Comparison_Operators
# * Basic Powershell Array *
$array = @("John", "Duck", 1, 2, 3)
$array
$array.GetType().Fullname
Write... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Basic Cmdlets 2.ps1 | Basic Cmdlets 2.ps1 | # Work script on basic information gathering cmdlets
#
# M. Cockrum 2/6/2016
#
Set-PSDebug -Strict
# Use Clear-Host to clear out the terminal
Clear-Host
# There are a numer of common parametets that all cmdlets take. You can find them by running
# Help about_CommonParameters
# Commands all have ... |
PowerShellCorpus/Github/markallen13_Powershell-Tutorials/Formatting.ps1 | Formatting.ps1 | # Work script on basic information working with Formatting Output
#
# M. Cockrum 3/14/2016
#
# There are three basic cmdlets for formatting output
Get-Process | Format-Table
Get-Process | Format-Table -Property ID,CPU,ProcessName
Get-Process | Format-List
Get-Process | Format-List *
Get-Process | Forma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.