full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/neilpeterson_azure-cli-scripts/cli-powershell/create-vm-detailed/create-vm-detailed.ps1 | create-vm-detailed.ps1 | # Variables
$publicdns = Get-Random
# Create a resource group.
az group create --name myResourceGroup --location westeurope
# Create a virtual network.
az network vnet create --resource-group myResourceGroup --location westeurope --name myVnet `
--address-prefix 192.168.0.0/16 --subnet-name mySubnet --subne... |
PowerShellCorpus/Github/jasonhorner_PowerShell/IOBenchmark.ps1 | IOBenchmark.ps1 | Set-StrictMode -version latest
<#
Based on:
http://blogs.msdn.com/b/sqlmeditation/archive/2013/04/04/choosing-what-sqlio-tests-to-run-and-automating-sqlio-testing-somewhat.aspx
#>
$computerName = $env:COMPUTERNAME
$numberofProcessors = $env:NUMBER_OF_PROCESSORS
$duration = 5 #300
$outputDirect... |
PowerShellCorpus/Github/Persistent13_PS.HealthChecks/build.psake.ps1 | build.psake.ps1 | #Requires -Modules psake
using namespace System.Diagnostics.CodeAnalysis;
Properties {
$ModuleName = 'PS.HealthChecks'
[SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssigments','')]
$SrcDir = '{0}\{1}' -f $PSScriptRoot, $ModuleName
[SuppressMessageAttribute('PSUseDeclaredVarsMoreThan... |
PowerShellCorpus/Github/Persistent13_PS.HealthChecks/build.ps1 | build.ps1 | param ( [string[]] $Task = 'default' )
if($env:APPVEYOR)
{
if($env:APPVEYOR_REPO_TAG -and $env:APPVEYOR_REPO_BRANCH -eq 'master')
{
Invoke-psake .\build.psake.ps1 -taskList Release -nologo
}
else
{
Invoke-psake .\build.psake.ps1 -nologo
}
exit ([int] (-not $psake... |
PowerShellCorpus/Github/Persistent13_PS.HealthChecks/PS.HealthChecks/Public/Connect-HealthCheck.ps1 | Connect-HealthCheck.ps1 | function Connect-HealthCheck
{
<#
.SYNOPSIS
The Connect-HealthCheck cmdlet store the API key for the HealthCheck module cmdlets.
Connect-HealthCheck will only store the API key, no validation is done.
.DESCRIPTION
The Connect-B2Cloud cmdlet is used to store the API key for the HealthCheck cmdlets.
... |
PowerShellCorpus/Github/Persistent13_PS.HealthChecks/PS.HealthChecks/Public/Get-HealthCheck.ps1 | Get-HealthCheck.ps1 | using module ..\Class\Check.Class.psm1
function Get-HealthCheck
{
<#
.SYNOPSIS
The Get-HealthCheck cmdlet will list all checks associated with the account.
.DESCRIPTION
The Get-HealthCheck cmdlet will list all checks associated with the account.
An API key is required to use this cmdlet.
.EXAMPLE... |
PowerShellCorpus/Github/Persistent13_PS.HealthChecks/PS.HealthChecks/Public/New-HealthCheck.ps1 | New-HealthCheck.ps1 | using module ..\Class\Check.Class.psm1
function New-HealthCheck
{
<#
.SYNOPSIS
New-HealthCheck will create a new health check.
.DESCRIPTION
New-HealthCheck will create a new health check.
An API key is required to use this cmdlet.
.EXAMPLE
New-HealthCheck -Name stoic-barbarian-lemur -Tag "pr... |
PowerShellCorpus/Github/Persistent13_PS.HealthChecks/Tests/PS.HealthChecks.Tests.ps1 | PS.HealthChecks.Tests.ps1 | $ModuleDir = Resolve-Path -Path $PSScriptRoot\..\Release
# Remove the module
Remove-Module 'PS.HealthChecks' -ErrorAction Ignore
if($env:APPVEYOR_HCHK_API_KEY -eq $null) {
# Using json key.
$settings = Get-Content $PSScriptRoot\testSettings.json | ConvertFrom-Json
$env:APPVEYOR_HCHK_API_KEY = $setti... |
PowerShellCorpus/Github/mike8411251995_test1/download.ps1 | download.ps1 | $runtimeUrl = $args[0]
$overrideUrl = $args[1]
$current = [string] (Get-Location -PSProvider FileSystem)
$client = New-Object System.Net.WebClient
function downloadWithRetry {
param([string]$url, [string]$dest, [int]$retry)
Write-Host
Write-Host "Attempt: $retry"
Write-Host
trap {
Write-Hos... |
PowerShellCorpus/Github/mahedee_AngularJS/AngularJSMVC/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/mahedee_AngularJS/AngularJSMVC/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/mahedee_AngularJS/AngularJSMVC/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/mahedee_AngularJS/AngularJSMVC/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/mahedee_AngularJS/AngularJSMVC/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/mahedee_AngularJS/AngularJSMVC/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/mahedee_AngularJS/AngularJSMVC/packages/EntityFramework.6.1.1/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/mahedee_AngularJS/AngularJSMVC/packages/EntityFramework.6.1.1/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/mahedee_AngularJS/AngularJSMVC/packages/Newtonsoft.Json.6.0.3/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/Queegmire_Config/Powershell/Get-Where.ps1 | Get-Where.ps1 | #Shorthand for filtering default property of lists
#RRJ - todo add flags for negation (also regex, case?)
function Get-Where {
<#
.SYNOPSIS
Quickly filter items
.DESCRIPTION
Equivilent to > Command | Where-Object { $_ -like '*filter*'}
.EXAMPLE
dir | Get-Where 'jpg'
.EXAMPLE
gc file.txt ... |
PowerShellCorpus/Github/Queegmire_Config/Powershell/Profile.ps1 | Profile.ps1 | #Disable beep when backspace is pressed at begining of line
Set-PSReadlineOption -BellStyle None
function isAdmin {
(([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([System.Security.Principal.WindowsBuiltInRole] "Administrator"))
}
# Replace $HOME with ~
f... |
PowerShellCorpus/Github/rikedje_TestaBygge/Hello.ps1 | Hello.ps1 | Write-Host 'Hello'
|
PowerShellCorpus/Github/rikedje_TestaBygge/build/psakeBuildScript.ps1 | psakeBuildScript.ps1 |
Properties {
$build_script_dir = Split-Path $psake.build_script_file
$project_name = "TestaBygge"
$root_dir = "$build_script_dir\.."
$nuget_spec = Join-Path $root_dir "$project_name.nuspec"
$designated_versionNumber = (Get-Date -format yyyy.MM.dd.HHmm).ToString()
$octo_apiKey = $env:OCTOKEY... |
PowerShellCorpus/Github/rikedje_TestaBygge/build/build.ps1 | build.ps1 | param($task = "default")
$scriptPath = $MyInvocation.MyCommand.Path
if(!$scriptPath) {
$scriptPath = Convert-Path ./build/build.ps1
}
$scriptDir = Split-Path $scriptPath
$packagesDir = Join-Path $scriptDir packages
$nuget_exe="$scriptDir\tools\NuGet.exe"
get-module psake | remove-module
& $nuge... |
PowerShellCorpus/Github/systems-bit_Azure_Automation/Runbook/Start-SourceControl.ps1 | Start-SourceControl.ps1 | workflow Start-SourceControl
{
#V3.0
#This is my first Source Control Runbook
#Added a minor change in GitHub
Write-Output "Azure Automation Source Control via GitHub"
}
|
PowerShellCorpus/Github/systems-bit_Azure_Automation/Runbook/Invoke-RunbookUsingAlerts.ps1 | Invoke-RunbookUsingAlerts.ps1 | #################################################################
workflow Invoke-RunbookUsingAlerts
{
param (
[object]$WebhookData
)
# If runbook was called from Webhook, WebhookData will not be null.
if ($WebhookData -ne $null) {
# Collect properties of WebhookData... |
PowerShellCorpus/Github/systems-bit_Azure_Automation/Runbook/Start-VMsFromWebhook.ps1 | Start-VMsFromWebhook.ps1 | ########################################
workflow Start-VMsFromWebhook
{
param (
[object]$WebhookData
)
# If runbook was called from Webhook, WebhookData will not be null.
if ($WebhookData -ne $null) {
# Collect properties of WebhookData
$WebhookName = $We... |
PowerShellCorpus/Github/systems-bit_Azure_Automation/Runbooks/Start-SourceControl.ps1 | Start-SourceControl.ps1 | workflow Start-SourceControl
{
#V1.0
#This is my first Source Control Runbook
Write-Output "Azure Automation"
} |
PowerShellCorpus/Github/systems-bit_Azure_Automation/Runbooks/Invoke-RunbookUsingAlerts.ps1 | Invoke-RunbookUsingAlerts.ps1 | #################################################################
workflow Invoke-RunbookUsingAlerts
{
param (
[object]$WebhookData
)
# If runbook was called from Webhook, WebhookData will not be null.
if ($WebhookData -ne $null) {
# Collect properties of WebhookData... |
PowerShellCorpus/Github/systems-bit_Azure_Automation/Runbooks/Start-VMsFromWebhook.ps1 | Start-VMsFromWebhook.ps1 | ########################################
workflow Start-VMsFromWebhook
{
param (
[object]$WebhookData
)
# If runbook was called from Webhook, WebhookData will not be null.
if ($WebhookData -ne $null) {
# Collect properties of WebhookData
$WebhookName = $We... |
PowerShellCorpus/Github/OPS-E2E-Prod_E2E_P_NewRepo_2017_4_1_13_24_17/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source url: ... |
PowerShellCorpus/Github/KirillPashkov_Anonymous-smtp-client/Anonymous-smtp-client.ps1 | Anonymous-smtp-client.ps1 | <#
--------------------------------------------------------------------------------
Generated on: 20.09.2015 11:42
Generated by: Kirill Pashkov
--------------------------------------------------------------------------------
#>
#region Source: Startup.pss
#------... |
PowerShellCorpus/Github/XiaolouT_LearningWin8/HelloWindows8/AppPackages/HelloWindows8_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.ps1 | Add-AppDevPackage.ps1 | #
# Add-AppxDevPackage.ps1 is a PowerShell script designed to install app
# packages created by Visual Studio for developers. To run this script from
# Explorer, right-click on its icon and choose "Run with PowerShell".
#
# Visual Studio supplies this script in the folder generated with its
# "Prepare Package" c... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC1/Mod7/_M7-Demo.ps1 | _M7-Demo.ps1 |
# NX is hostname, 192.168.3.20
# Copy Resource module and show.
Copy-item -Path C:\Scripts\DSC1\Mod7\nx -Destination C:\Windows\System32\WindowsPowerShell\v1.0\Modules -Recurse -Force
Get-DscResource
# Get pre-req and build OMI Server
Start-Process -FilePath iexplore http://blogs.technet.com/b/privatecloud... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC1/Mod7/WordPressConfig.ps1 | WordPressConfig.ps1 | $OFS=[Environment]::Newline
#Read Script elements from text files
$ConfigGet = Get-Content "c:\scripts\DSC1\Mod7\scripts\get.txt"
$ConfigSet = Get-Content "c:\scripts\DSC1\Mod7\scripts\set.txt"
$ConfigTest = Get-Content "c:\scripts\DSC1\Mod7\scripts\test.txt"
#Get WPConfig from file
$WPConfig = Get-Content... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC1/Mod7/ResetDSCDemo.ps1 | ResetDSCDemo.ps1 | $OFS=[Environment]::Newline
#Read Script elements from text files
$Get = Get-Content ".\reset\resetget.txt"
$Set = Get-Content ".\reset\resetset.txt"
$Test = Get-Content ".\reset\resettest.txt"
#Get WPConfig from file
$WPConfig = Get-Content ".\scripts\WP-Config.txt"
#Define WordPress Server Configuration... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC1/Mod7/WPDemoApply.ps1 | WPDemoApply.ps1 | $securePass=ConvertTo-SecureString -string "P@ssw0rd" -AsPlainText -Force
$cred= New-Object System.Management.Automation.PSCredential "root", $SecurePass
$opt = New-CimSessionOption -UseSsl:$true -SkipCACheck:$true -SkipCNCheck:$true -SkipRevocationCheck:$true
$demo1=New-CimSession -Credential:$cred -ComputerNam... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC1/Mod7/_NX_OMI.ps1 | _NX_OMI.ps1 | Start-Process -FilePath iexplore http://blogs.technet.com/b/privatecloud/archive/2014/05/19/powershell-dsc-for-linux-step-by-step.aspx
# Do not run in Windows PowerShell -- CentOS 6
# 1. Install required Pre-Req packages
yum groupinstall 'Development Tools'
yum install pam-devel
yum install openssl-devel
yum ... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod3/Config_Feature.ps1 | Config_Feature.ps1 | Configuration Demo_Feature {
Import-DSCResource -ModuleName MVADemo
Node s1 {
MVAFeature Backup {
FeatureName= 'windows-server-backup'
Installed= $True
Ensure = 'Present'
}
}
}
Demo_Feature
Start-DscConfiguration -Path .\Demo... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod3/LCM_HTTPPull.ps1 | LCM_HTTPPull.ps1 | [DSCLocalConfigurationManager()]
Configuration LCM_HTTPPULL
{
param
(
[Parameter(Mandatory=$true)]
[string[]]$ComputerName,
[Parameter(Mandatory=$true)]
[string]$guid
)
Node $ComputerName {
Settings{
AllowModuleOverwr... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod3/Config_Service.ps1 | Config_Service.ps1 | Configuration Demo_Service {
Import-DSCResource -ModuleName MVADemo
Node s2 {
MVAService Bits {
ServiceName = 'bits'
Servicestatus = 'running'
Ensure = 'Present'
}
}
}
Demo_Service -OutputPath C:\Scripts\DSC2\Mod3\Config
|
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod3/_M3_demo.ps1 | _M3_demo.ps1 | # 1. Push Deployment
Copy-item -Path C:\Scripts\DSC2\mod3\MVADemo -Destination 'C:\Program Files\WindowsPowerShell\Modules\MVADemo' -Recurse -Force
explorer 'C:\Program Files\WindowsPowerShell\Modules'
Get-DscResource
# 2. Pull server
# Show module version in .psd1
ise C:\Scripts\dsc2\Mod3\MVADemo\MVADemo.p... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod7/WebServerConfig.ps1 | WebServerConfig.ps1 | Configuration WebServer {
Node s3 {
WindowsFeature web {
Name = 'web-server'
Ensure = 'Present'
}
}
}
webserver -outputpath c:\config
|
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod7/Config_NLB.ps1 | Config_NLB.ps1 | Configuration NLB {
Node s3 {
WindowsFeature NEwNLB {
Name='NLB'
Ensure = 'Present'
}
}
}
NLB -outputpath C:\DSCSMB
|
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod7/_M7-Demo.ps1 | _M7-Demo.ps1 |
# 1. Composite resource structure
ise C:\Scripts\DSC2\Mod7\LCM_Partial_Notes.ps1
ise C:\Scripts\DSC2\Mod7\LCM_Partial_Notes2.ps1
# Actual LCM Config
ise C:\Scripts\DSC2\Mod7\LCM_Partial.ps1
# Set the LCM
# Should remove configs Remove-DSCConfigurationDocuments
Set-DscLocalConfigurationManager -Path C:\Scripts\... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod7/LCM_Partial_Notes2.ps1 | LCM_Partial_Notes2.ps1 | [DSCLocalConfigurationManager()]
configuration SQLServerDSCSettings
{
Node localhost
{
Settings
{
ConfigurationModeFrequencyMins = 30
}
ConfigurationRepositoryWeb OSConfigServer
{
ServerURL = "https://corp.contoso.com/OSConfigServe... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod7/LCM_Partial.ps1 | LCM_Partial.ps1 | [DscLocalConfigurationManager()]
Configuration partialMeta
{
Node s3 {
Settings
{
RefreshMode = "Pull"
RefreshFrequencyMins = 30
ConfigurationModeFrequencyMins = 15
ConfigurationMode = "ApplyAndAutoCorrect"
RebootNodeIfNeeded = $True
Configu... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod7/LCM_Partial_Notes.ps1 | LCM_Partial_Notes.ps1 | [DscLocalConfigurationManager()]
Configuration partialMeta
{
Settings
{
RefreshMode = "PULL"
RefreshFrequencyMins = 30
ConfigurationModeFrequencyMins = 15
ConfigurationMode = "ApplyAndAutoCorrect"
RebootNodeIfNeeded = $false
ConfigurationId = "922A3987-... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/ClassStructureSimple.ps1 | ClassStructureSimple.ps1 | # From release notes
enum Ensure
{
Absent
Present
}
[DscResource()]
class FileResource
{
[DscProperty(Key)]
[string]$Path
[DscProperty(Mandatory)]
[Ensure] $Ensure
[DscProperty(Mandatory)]
[string] $SourcePath
[DscProperty(NotConfigurable)]
... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/test.ps1 | test.ps1 | enum Ensure {
Absent
Present
}
[DscResource()]
class ClassService {
[DscProperty(Key)]
[string]$serviceName
[DscProperty(Mandatory)]
[Ensure] $Ensure
[DscProperty(Mandatory)]
[string] $Servicestatus
[ClassService] Get() {
$serviceExists = Get-Serv... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/config_class.ps1 | config_class.ps1 | Configuration Demo_Class {
Import-DSCResource -ModuleName MVAClassService
Node dc {
ClassService bits {
Servicename = 'bits'
Servicestatus = 'Running'
Ensure = 'Present'
}
}
}
Demo_class
|
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/_M4-Demo.ps1 | _M4-Demo.ps1 |
# 1. Custom resource structure using classes
# use for example and explain
ise C:\Scripts\DSC2\Mod4\ClassStructure.ps1
ise C:\Scripts\DSC2\Mod4\ClassStructureSimple.ps1
ise C:\Scripts\dsc2\Mod4\ClassManifeststructure.ps1
# 2. Create a class-defined custom resource
ise C:\Scripts\DSC2\Mod4\Class\MVAClassSe... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/ClassStructure.ps1 | ClassStructure.ps1 | # From release notes
enum Ensure
{
Absent
Present
}
<#
This resource manages the file in a specific path.
[DscResource()] indicates the class is a DSC resource
#>
[DscResource()]
class FileResource
{
<#
This property is the fully qualified path to the file that is
e... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/LCM_Class.ps1 | LCM_Class.ps1 | [DSCLocalConfigurationManager()]
Configuration Debugmode
{
Node dc
{
Settings
{
AllowModuleOverwrite = $True
ConfigurationMode = 'ApplyAndAutoCorrect'
RefreshMode = 'Push'
Debugmode = 'All'
}
}
}
DebugMode -OutputPath C:\scripts\dsc2\Mod4
# Send to computer... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod4/ClassManifeststructure.ps1 | ClassManifeststructure.ps1 | @{
# Script module or binary module file associated with this manifest.
RootModule = 'MyDscResource.psm1'
# Version number of this module.
ModuleVersion = '1.0'
# ID used to uniquely identify this module
GUID = '81624038-5e71-40f8-8905-b1a87afe22d7'
# Author of this module
Author = 'User01'
# Company... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod1/_M1-Demo.ps1 | _M1-Demo.ps1 | # 1. DSC custom resource architecture overview
# 3 Show the three files, then copy to bad location just to show
# that the custom resource works. Then delete.
ise C:\Scripts\DSC2\Mod1\MVAService\MVAService.schema.mof
ise C:\Scripts\dsc2\mod1\MVAService\MVAService.psm1
ise C:\Scripts\DSC2\Mod1\MVAService\MVASer... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod5/4.Config_Feature.ps1 | 4.Config_Feature.ps1 | Configuration Demo_Feature {
Import-DSCResource -ModuleName MVADemo
Node s1 {
MVAFeature Backup {
FeatureName= 'web-server'
Installed= $False
Ensure = 'Present'
}
}
}
Demo_Feature -outputpath C:\Scripts\DSC2\mod5\config
Start... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod5/3.LCM_Reboot.ps1 | 3.LCM_Reboot.ps1 | Configuration LCM_Reboot
{
Node s1
{
localconfigurationmanager
{
AllowModuleOverwrite = $True
ConfigurationMode = 'ApplyAndAutoCorrect'
RefreshMode = 'Push'
Debugmode = 'All'
RebootNodeIfNeeded = $True
}
}
}
LCM_Reboot -OutputPath C:\scripts\dsc2\M... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod5/_M5-Demo.ps1 | _M5-Demo.ps1 |
# 1. Adding verbose and debug messages
ise C:\Scripts\DSC2\Mod5\1.MVAServiceverbose.psm1
# Add the following code to Test-Target - this has error checking and verbose
ise C:\scripts\DSC2\Mod5\2.Verbosetestcode.ps1
# 2. Adding help content
ise C:\Scripts\DSC2\Mod5\about_MVADemo.help.txt
# Create folder in ... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod5/2.Verbosetestcode.ps1 | 2.Verbosetestcode.ps1 | [CmdletBinding(SupportsShouldProcess=$true)]
[OutputType([System.Boolean])]
param
(
#[parameter(Mandatory = $true)]
[System.String]
$ServiceName='bitsss',
[ValidateSet("Running","Stopped")]
[System.String]
$Servicestatus='running',
[ValidateSet("Present","Absent")]
[System.String]
$E... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod2/_M2_Demo.ps1 | _M2_Demo.ps1 | # Designing info URLs
Start-Process -FilePath iexplore http://blogs.msdn.com/b/powershell/archive/2014/11/18/powershell-dsc-resource-design-and-testing-checklist.aspx
Start-Process -FilePath http://blogs.msdn.com/b/powershell/archive/2014/11/19/documenting-dsc-part-2.aspx
Start-Process -FilePath http://www.microsoft... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod6/_M6-Demo.ps1 | _M6-Demo.ps1 |
# 1. Composite resource structure
ise C:\Scripts\DSC2\Mod6\Config_composite.psm1
# Save as Baseconfig.schema.psm1 in folder structure
copy-item C:\scripts\dsc2\mod6\Config_composite.psm1 -Destination C:\scripts\DSC2\Mod6\BaseConfig.schema.psm1 -force
#Create new folder and copy composite resource
New-Item -Path ... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod6/WebConfig.ps1 | WebConfig.ps1 | Configuration WebServer {
Import-DscResource -ModuleName CompositeDSC
Node s1 {
baseconfig Base {
servicename = 'audiosrv'
}
WindowsFeature web {
Name = 'web-server'
Ensure = 'Present'
}
}
}
webserver -out... |
PowerShellCorpus/Github/Chronopath_Github-Repository/Powershell--[ForPractice]DSC2/Mod6/LCM_setup.ps1 | LCM_setup.ps1 | Configuration LCM_Reboot
{
Node s1
{
localconfigurationmanager
{
AllowModuleOverwrite = $True
ConfigurationMode = 'ApplyAndAutoCorrect'
RefreshMode = 'Push'
Debugmode = 'All'
RebootNodeIfNeeded = $True
}
}
}
LCM_Reboot -OutputPath C:\scripts\dsc2\M... |
PowerShellCorpus/Github/JasonMorgan_ServiceManagerConnector/Alerts/AlertsConnector.ps1 | AlertsConnector.ps1 | #requires -module SevOne
param (
[string]$SevOneServer = 'Pdcd18-sevone01a',
[string]$ServiceManagerServer = $env:COMPUTERNAME,
[Parameter(Mandatory)]
[pscredential]$SevOneCred,
[pscredential]$ServiceManCred
)
#region import modules
Import-Module 'D:\Program Files\Microsoft System ... |
PowerShellCorpus/Github/defensivedepth_Pertinax/normalize/ar-normalize.ps1 | ar-normalize.ps1 | <#
Original Author: Josh Brower, Josh@DefensiveDepth.com
Version: 2016.05.23-Rev1
This script is licensed under the terms of the MIT license.
This script formats Sysinternals' AutoRunsc CSV Logs in a
way that Security Onion can consume and parse using OSSEC & ELSA.
Tested with Autorunsc v13.51
Logs must... |
PowerShellCorpus/Github/defensivedepth_Pertinax/diff/ar-diff.ps1 | ar-diff.ps1 | <#
Original Author: Josh Brower, Josh@DefensiveDepth.com
Version: 2016.06.02-Rev1
This script is licensed under the terms of the MIT license.
This script compares Sysinternals' AutoRunsc CSV Logs with
a previously run log from the same system, filters out any
autoruns' entries that were removed, and outputs t... |
PowerShellCorpus/Github/AaronSaikovski_chocolatelyinstallers/chocolately-install.ps1 | chocolately-install.ps1 | set-executionpolicy bypass -Force
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco install chocolatey -y
choco install googlechrome -y
choco install firefox -y
choco install dotnet3.5 -y
choco install filezilla -y
choco install sublimetext3 -y
choco install teamvie... |
PowerShellCorpus/Github/OPSTest_E2E_D_NewRepo_1490302704875/.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/marcusclayton_AzureLogicAppDemo/ps.ps1 | ps.ps1 | <#$
{
"Name": "First Last",
"Email": "firstlast@example.org",
"Subject": "My Subject",
"Message": "My Message."
}
#>
$uri = "<URI_HERE>"
$body = ConvertTo-Json @{
Name = 'Marcus Clayton'
Email = "marcus@cco.com"
Subject = "Git Issue 1"
Message = "First Gi... |
PowerShellCorpus/Github/vors_ZLocation/default.ps1 | default.ps1 | task default -depends Test
task Test {
$res = Invoke-Pester $PSScriptRoot\ZLocation.Tests -PassThru
if ($res.FailedCount -gt 0) {
throw "$($res.FailedCount) tests failed."
}
}
task AppveyorTest {
$testResultsFile = ".\TestsResults.xml"
$res = Invoke-Pester -OutputFormat NUnitXm... |
PowerShellCorpus/Github/vors_ZLocation/ZLocation.Tests/ZLocation.Search.Tests.ps1 | ZLocation.Search.Tests.ps1 | Import-Module $PSScriptRoot\..\ZLocation\ZLocation.Search.psm1 -Force
Describe 'Find-Matches filters results correctly' {
Context 'Equal weight' {
$data = @{
'C:\foo1\foo2\foo3' = 1.0
'C:\foo1\foo2' = 1.0
'C:\foo1' = 1.0
'C:\' = 1.0
}
... |
PowerShellCorpus/Github/vors_ZLocation/ZLocation.Tests/ZLocation.Tests.ps1 | ZLocation.Tests.ps1 | # This is integration tests.
# -Force re-import nested modules as well
#Import-Module $PSScriptRoot\..\ZLocation\ZLocation.Storage.psm1 -Force
#Import-Module $PSScriptRoot\..\ZLocation\ZLocation.Search.psm1 -Force
Import-Module $PSScriptRoot\..\ZLocation\ZLocation.psm1 -Force
Describe 'ZLocation' {
C... |
PowerShellCorpus/Github/vors_ZLocation/ZLocation.Tests/Meta.Tests.ps1 | Meta.Tests.ps1 | $ErrorActionPreference = 'stop'
Set-StrictMode -Version latest
$RepoRoot = (Resolve-Path $PSScriptRoot\..).Path
Describe 'Text files formatting' {
$allTextFiles = ls -File -Recurse $RepoRoot
Context 'Files encoding' {
It "Doesn't use Unicode encoding" {
$allTextFiles... |
PowerShellCorpus/Github/vors_ZLocation/ZLocation.Tests/ZLocation.Storage.Tests.ps1 | ZLocation.Storage.Tests.ps1 | Import-Module $PSScriptRoot\..\ZLocation\ZLocation.Storage.psm1 -Force
Describe 'ZLocation.Storage' {
$originalCount = (Get-ZLocation).Count
try {
$path = [guid]::NewGuid().Guid
$path2 = [guid]::NewGuid().Guid
It 'can add weight' {
$w1 = 6.6
... |
PowerShellCorpus/Github/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/packages/Microsoft.ApplicationInsights.WindowsServer.2.2.0/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
if ([System.IO.File]::Exists($project.FullName))
{
function MarkItemASCopyToOutput($item)
{
Try
{
#mark it to copy if newer
$item.Properties.Item("CopyToOutputDirectory").Value = 2
}
Catch
{
write-host $_.Exception.ToString()
}... |
PowerShellCorpus/Github/surabhshah_OneClick/OneClickDeploy/packages/Microsoft.Web.Infrastructure.1.0.0.0/tools/Install.ps1 | Install.ps1 | param($installPath, $toolsPath, $package, $project)
if ($project.Type -eq 'Web Site') {
Import-Module (Join-Path $toolsPath VS.psd1)
$srcFiles = Join-Path $installPath "lib\net40\*.dll"
$projectRoot = Get-ProjectRoot $project
if (!$projectRoot) {
return;
}
$destDirec... |
PowerShellCorpus/Github/surabhshah_OneClick/OneClickDeploy/packages/Microsoft.Web.Infrastructure.1.0.0.0/tools/Uninstall.ps1 | Uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
if ($project.Type -eq 'Web Site') {
Import-Module (Join-Path $toolsPath VS.psd1)
$projectRoot = Get-ProjectRoot $project
if (!$projectRoot) {
return;
}
$binDirectory = Join-Path $projectRoot "bin"
$srcDirectory = Join-Path $... |
PowerShellCorpus/Github/surabhshah_OneClick/OneClickDeploy/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/surabhshah_OneClick/OneClickDeploy/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3/tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$projectRoot = $project.Properties.Item('FullPath').Value
$binDirectory = Join-Path $projectRoot 'bin'
$targetDirectory = Join-Path $binDirectory $roslynSubFolder
if (Te... |
PowerShellCorpus/Github/surabhshah_OneClick/OneClickDeploy/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
$compilerPackageName = 'Microsoft.Net.Compilers'
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$libDirectory = Join-Path $installPath 'lib\net45'
$projectRoot = $project.Properties.Item('FullPath').Value
$binDirectory... |
PowerShellCorpus/Github/Abhimanyu-Jana_CalcuLite/ScientificCalculator/AppPackages/ScientificCalculator_1.1.0.2_AnyCPU_Test/Add-AppDevPackage.ps1 | Add-AppDevPackage.ps1 | #
# Add-AppxDevPackage.ps1 is a PowerShell script designed to install app
# packages created by Visual Studio for developers. To run this script from
# Explorer, right-click on its icon and choose "Run with PowerShell".
#
# Visual Studio supplies this script in the folder generated with its
# "Prepare Package" c... |
PowerShellCorpus/Github/malichite_VMWare/SetGuestIP.ps1 | SetGuestIP.ps1 | #Set VM Guest IP addresses
Function Set-WinVMIP ($VM, $HC, $GC, $IP, $SNM, $GW){
$netsh = "c:\windows\system32\netsh.exe interface ip set address ""Local Area Connection 3"" static $IP $SNM $GW 1"
Write-Host "Setting IP address for $VM..."
Invoke-VMScript -VM $VM -HostCredential $HC -GuestCredential $GC -ScriptT... |
PowerShellCorpus/Github/malichite_VMWare/VMBuild.ps1 | VMBuild.ps1 | $vms = Import-CSV D:\PSScripts\vmware\deploy.csv
$localPW = read-host -AsSecureString “Please enter the local admin password”
$userName = read-host “Please type a username that can add machines to the domain”
$userPW = read-host -AsSecureString “Please enter your password”
$pLocalPW = [system.Runtime.InteropServic... |
PowerShellCorpus/Github/malichite_VMWare/QuickBuild.ps1 | QuickBuild.ps1 | #vmbuild
$vmname="server1","server2","server3","server4"
$vmHosts = get-cluster vmCluster | get-vmhost
$custom=get-OSCustomizationSpec customizationSpec
$template=get-template templateName
$datastore=get-vmhost someHost | get-datastore
foreach ($vm in $vmname){
$vmhost=get-random -input $vmhosts
new-vm ... |
PowerShellCorpus/Github/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/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/makskb_site/Blacklist/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
$compilerPackageName = 'Microsoft.Net.Compilers'
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$libDirectory = Join-Path $installPath 'lib\net45'
$packageDirectory = Split-Path $installPath
$compilerPackage = Get-Chil... |
PowerShellCorpus/Github/makskb_site/Blacklist/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$projectRoot = $project.Properties.Item('FullPath').Value
$binDirectory = Join-Path $projectRoot 'bin'
$targetDirectory = Join-Path $binDirectory $roslynSubFolder
if (Te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.