full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/GeeLaw_1drv-layout/Assert-NoOneDriveError.ps1
Assert-NoOneDriveError.ps1
Function Assert-NoOneDriveError { Param ( [object]$ResponseObject ) if ($ResponseObject.error -eq $null) { Return $true; } $local:mainErrorCode = $ResponseObject.error.code; $local:errorSb = [System.Text.StringBuilder]::new($ResponseObject.error.message); ...
PowerShellCorpus/Github/GeeLaw_1drv-layout/New-OneDriveFolder.ps1
New-OneDriveFolder.ps1
Function New-OneDriveFolder { Param ( [Parameter(Mandatory = $true)] [string]$AccessToken, [Parameter(Mandatory = $true)] [string]$Name ) $local:ErrorActionPreference = 'Stop'; $local:parent = Get-OneDriveItem -AccessToken $AccessToken -Id ((Get-Item '.').Na...
PowerShellCorpus/Github/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/packages/Microsoft.ApplicationInsights.WindowsServer.2.1.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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/plamivanov_PhoneBookASP-Mvc-Quick/PhoneBook/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/martin9700_Get-FolderSize/Get-FolderSize.ps1
Get-FolderSize.ps1
Function Get-FolderSize { <# .SYNOPSIS Get a list of folders and their size .DESCRIPTION Point the script at a folder and it will report all the subfolders and their size .PARAMETER Path Path that you point the script at. All subfolders will be processed .INPUTS ...
PowerShellCorpus/Github/danielheth_domain-user/reset.ps1
reset.ps1
param ( [string]$username = $(throw "-username is required."), [string]$password = $(throw "-password is required.") ) if ($username.Contains("@")) { $usr = $username.Split("@",2); $username = $usr[0]; $domain = $usr[1]; } else { $dom = [System.DirectoryServices.ActiveDirectory.Dom...
PowerShellCorpus/Github/dotad_ProjectZero/GetDC.ps1
GetDC.ps1
#requires -version 2 <# File: GetDC.ps1 Author: (@mishradhiraj_) #> $getdomain = [System.Directoryservices.Activedirectory.Domain]::GetCurrentDomain() $getdomain | ForEach-Object {$_.DomainControllers} | ForEach-Object { $hEntry= [System.Net.Dns]::GetHostByName($_.Name) New-Object -TypeName PSOb...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Build.PSDeploy.ps1
Build.PSDeploy.ps1
Deploy Posh-Teamviewer { By PlatyPS { FromSource "$BHProjectPath\docs\Commands" To "$BHProjectPath\Posh-Teamviewer\en-US" Tagged Help WithOptions @{ Force = $true } } By FileSystem { FromSource $ENV:BHProjectName To "$hom...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Build.Psake.ps1
Build.Psake.ps1
Task default -depends Deploy Properties { Set-BuildEnvironment $ErrorActionPreference = 'Stop' $ProjectRoot = $ENV:BHProjectPath $ProjectName = $ENV:BHProjectName if(-not $ProjectRoot) { [ValidateNotNullOrEmpty()]$ProjectRoot = $Psake.build_script_dir } if(-not $ProjectName) { [...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Private/Get-TeamviewerChoice.ps1
Get-TeamviewerChoice.ps1
function Get-TeamviewerChoice { [CmdletBinding()] Param ( [System.String]$Message = 'There were multiple matches', [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [System.String[]]$Choices, [System.Int32]$DefaultChoice = 0, ...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Private/Get-TeamviewerDeviceProperty.ps1
Get-TeamviewerDeviceProperty.ps1
function Get-TeamviewerDeviceProperty { [CmdletBinding(DefaultParameterSetName = 'remotecontrol_id')] param ( [Parameter(Mandatory=$true)] [string]$ComputerName, [Parameter(ParameterSetName = 'device_id')] [switch]$device_id, [Parameter(ParameterS...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Private/Resolve-TeamviewerConfigPath.ps1
Resolve-TeamviewerConfigPath.ps1
function Resolve-TeamviewerConfigPath { [CmdletBinding()] [OutputType([String])] param() Begin { } Process { Write-Verbose -Message 'Resolving Teamviewer Config Path' $Global:TeamviewerConfigPath = "$env:APPDATA\Teamviewer" Write-Verbose -Messa...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Public/Set-TeamviewerAccessToken.ps1
Set-TeamviewerAccessToken.ps1
# .ExternalHelp Teamviewer-Help.xml function Set-TeamviewerAccessToken { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [securestring]$AccessToken, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=1)] [securestring]$MasterPassword...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Public/Update-TeamviewerDevice.ps1
Update-TeamviewerDevice.ps1
# .ExternalHelp Teamviewer-Help.xml Function Update-TeamviewerDevice { [CmdletBinding()] param ( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$ComputerName, [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] ...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Public/Initialize-Teamviewer.ps1
Initialize-Teamviewer.ps1
# .ExternalHelp Teamviewer-Help.xml function Initialize-Teamviewer { [CmdletBinding()] Param ( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] [securestring]$MasterPassword ) Begin { # Test if configuration file exists....
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Public/Set-TeamviewerDeviceList.ps1
Set-TeamviewerDeviceList.ps1
# .ExternalHelp Teamviewer-Help.xml Function Set-TeamviewerDeviceList { [CmdletBinding()] param ( [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$false)] [securestring]$AccessToken ) Begin { Write-Verbose -Message 'Starting: Set Teamviewer De...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Posh-Teamviewer/Public/Connect-Teamviewer.ps1
Connect-Teamviewer.ps1
# .ExternalHelp Teamviewer-Help.xml function Connect-Teamviewer { [CmdletBinding(DefaultParameterSetName = 'List')] param ( [Parameter(ParameterSetName = 'List', Mandatory=$true)] [Parameter(ParameterSetName = 'Update', Mandatory=$true)] [string[]]$ComputerName, ...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Get-TeamviewerDeviceProperty.Tests.ps1
Get-TeamviewerDeviceProperty.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 $Json = @" { "devices":[ { "remotecontrol_id":"r123456789", "device_id":"d12345678", "alias":"Device1", "groupid":"g1234567", ...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Module.Help.Tests.ps1
Module.Help.Tests.ps1
<# .SYNOPSIS Tests the PowerShell help for the commands in a module. .DESCRIPTION This Pester test verifies that the commands in a module have basic help content. It works on all command types and both comment-based and XML help. This test verifies that Get-Help is not autogenerating help because it cannot...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Connect-Teamviewer.Tests.ps1
Connect-Teamviewer.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 InModuleScope 'Posh-Teamviewer' { Describe 'Connect-Teamviewer' { $AccessToken = ConvertTo-SecureString -String 'Fake-AccessTokenText123456789' -AsPlainText -Force $Password = Conver...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Set-TeamviewerAccessToken.Tests.ps1
Set-TeamviewerAccessToken.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 InModuleScope 'Posh-Teamviewer' { Describe 'Set-TeamviewerAccessToken' { $AccessToken = ConvertTo-SecureString -String 'Fake-AccessTokenText123456789' -AsPlainText -Force $MasterPasswo...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Initialize-Teamviewer.Tests.ps1
Initialize-Teamviewer.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 $Global:TeamviewerAccessToken = $null InModuleScope 'Posh-Teamviewer' { Describe 'Initialize-Teamviewer' { $MasterPassword = ConvertTo-SecureString -String 'FakePassword' -AsPlainTex...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Resolve-TeamviewerConfigPath.Tests.ps1
Resolve-TeamviewerConfigPath.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 InModuleScope 'Posh-Teamviewer' { Describe 'Resolve-TeamviewerConfigPath' { Context 'Returns Config Directory' { It 'global variable should not be present' { ...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Update-TeamviewerDevice.Tests.ps1
Update-TeamviewerDevice.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 InModuleScope 'Posh-Teamviewer' { Describe 'Update-TeamviewerDevice' { $AccessToken = ConvertTo-SecureString -String 'Fake-AccessTokenText123456789' -AsPlainText -Force $Password = '...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Set-TeamviewerDeviceList.Tests.ps1
Set-TeamviewerDeviceList.Tests.ps1
Import-Module Pester -ErrorAction Stop Import-Module $PSScriptRoot\..\Posh-Teamviewer\Posh-TeamViewer.psd1 $Json = @" { "devices":[ { "remotecontrol_id":"r123456789", "device_id":"d12345678", "alias":"Device1", "groupid":"g1234567", ...
PowerShellCorpus/Github/gerane_Posh-Teamviewer/Tests/Module.Links.Tests.ps1
Module.Links.Tests.ps1
#TODO: Convert to PoshSpec $Links = @() $MarkdownLinks = Get-ChildItem $PSScriptRoot\..\* -Include '*.md' -Recurse | Select-String '^.*\[.*\]\((http.*)\).*$' -AllMatches foreach ($Match in $MarkdownLinks) { $Links += @{$Match.Matches.Groups.value[1] = $Match.Path} } $Files = $Links.Values | Sort-Object...
PowerShellCorpus/Github/FMV1491_Application-Programming-using-c-/Falguni-aasgn11/week_11/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/FMV1491_Application-Programming-using-c-/Falguni-aasgn11/week_11/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/AllCovered_format-bootable-USB-drive/Mass-Format-USB.ps1
Mass-Format-USB.ps1
<# .SYNOPSIS Mass-Format-USB.ps1 Original Author(s): Johnathan Milgie Version 1.0.0, 12/10/2016 MIT License Copyright (c) 2016 Konica Minolta Business Solutions U.S.A., Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated...
PowerShellCorpus/Github/wgross_Jump/2.0/Jump.Test.ps1
Jump.Test.ps1
Import-Module Pester Import-Module $PSScriptRoot\Jump.psm1 -Force Describe "Set-Jump cmdlet" { BeforeEach { Clear-Jumps } It "Set-Jump -Name writes an updated jump file to the disk" { Set-Jump -Name "test" -Destination "c:\test" Test-Path $PSScript...
PowerShellCorpus/Github/slehmann36_MBExport/MBExport.ps1
MBExport.ps1
# Mailbox Export # Version 1.1.0 # # Run bulk mailbox exports as a scheduled task. # Copyright (C) 2016 Simon Lehmann # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PowerShellCorpus/Github/mtorres066_Sistema-de-Ventas/Cвdigo Fuente/SisVentas/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/mtorres066_Sistema-de-Ventas/Cвdigo Fuente/SisVentas/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/fenxu_fenxu_test_prod_family/.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 ur...
PowerShellCorpus/Github/lukeeckley_Dell-BIOS-Version-Check/check-dell-bios-versions.ps1
check-dell-bios-versions.ps1
<# check-dell-bios-versions.ps1 Copyright © 2016 Luke Eckley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, mod...
PowerShellCorpus/Github/AndySchneiderDev_ADFS/Get-ADFSToken.ps1
Get-ADFSToken.ps1
param( [Parameter()][ValidateSet('Windows','UserName')] $ClientCredentialType="UserName", [Parameter(Mandatory=$true)] $Server, [Parameter()] $AppliesTo = "urn:adfsmonitor", [Parameter()] $Username ="", [Parameter()] $Password="", [Parameter()] $Domain ="", [Parameter()][ValidateSet('...
PowerShellCorpus/Github/Stijnc_Ansible-playbooks/files/helloworld.ps1
helloworld.ps1
Write-Host Write-Host 'Hello World!' Write-Host "Good-bye World! `n"
PowerShellCorpus/Github/MSUDenverSystemsEngineering_CaseWare-IDEA-Repair/Deploy-Application.ps1
Deploy-Application.ps1
<# .SYNOPSIS This script performs the installation or uninstallation of an application(s). .DESCRIPTION The script is provided as a template to perform an install or uninstall of an application(s). The script either performs an "Install" deployment type or an "Uninstall" deployment type. The install deploymen...
PowerShellCorpus/Github/MSUDenverSystemsEngineering_CaseWare-IDEA-Repair/AppDeployToolkit/AppDeployToolkitExtensions.ps1
AppDeployToolkitExtensions.ps1
<# .SYNOPSIS This script is a template that allows you to extend the toolkit with your own custom functions. .DESCRIPTION The script is automatically dot-sourced by the AppDeployToolkitMain.ps1 script. .NOTES Toolkit Exit Code Ranges: 60000 - 68999: Reserved for built-in exit codes in Deploy-Applicatio...
PowerShellCorpus/Github/MSUDenverSystemsEngineering_CaseWare-IDEA-Repair/AppDeployToolkit/AppDeployToolkitMain.ps1
AppDeployToolkitMain.ps1
<# .SYNOPSIS This script contains the functions and logic engine for the Deploy-Application.ps1 script. .DESCRIPTION The script can be called directly to dot-source the toolkit functions for testing, but it is usually called by the Deploy-Application.ps1 script. The script can usually be updated to the latest v...
PowerShellCorpus/Github/MSUDenverSystemsEngineering_CaseWare-IDEA-Repair/AppDeployToolkit/AppDeployToolkitHelp.ps1
AppDeployToolkitHelp.ps1
<# .SYNOPSIS Displays a graphical console to browse the help for the App Deployment Toolkit functions .DESCRIPTION Displays a graphical console to browse the help for the App Deployment Toolkit functions .EXAMPLE AppDeployToolkitHelp.ps1 .NOTES .LINK http://psappdeploytoolkit.com #> ##*================...
PowerShellCorpus/Github/dshkwnds_ELK-for-vSphere/set syslog.ps1
set syslog.ps1
Connect-VIServer vCenter Server -user Username -password Password $VMHosts = Get-VMHost | Sort-Object Name $syslogserver = "tcp://Syslog Server IP" foreach ($VMHost in $VMHosts) { $FW = $VMhost | Get-VMHostFirewallException | Where {$_.Name -eq ‘syslog’} | Set-VMHostFirewallException -Enabled $True Set-VMHostAd...
PowerShellCorpus/Github/godfreybr_MS17-010-Scanner/MS17-010-Scanner.ps1
MS17-010-Scanner.ps1
# TITLE: MS17-010-Scanner # AUTHOR: Brennan Godfrey # DESCRIPTION: Scans local machine & list of network devices for MS17-010 hotfixes # VERSION: 1.2 # DATE: 16/05/2017 # List of machines to be scanned on the network # Format: @("MyServer01","MyServer02","MyServer03") # Leave empty if you wish to only scan the...
PowerShellCorpus/Github/OPSTest_E2E_NewRepo_1489025141896/.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/nzjoshellis_Add-DomainController/Add-DomainController.ps1
Add-DomainController.ps1
################################################################ # SCRIPT: Add-DomainController # AUTHOR: Josh Ellis - Josh@JoshEllis.NZ # Website: JoshEllis.NZ # VERSION: 1.0 # DATE: 12/03/2016 # DESCRIPTION: Promotes a Server to a Domain Controller ##############################################################...
PowerShellCorpus/Github/netzoft_PowerShell/Set-GPO-Java_Permissions.ps1
Set-GPO-Java_Permissions.ps1
$pcs = get-content "c:\temp\Java_PCs.txt" $pcs "---------------------------------------" "Count: " + $pcs.count $pcs | ForEach-Object{ ##ADD PCs Set-GPPermissions -Name "UK-HL-CMP-SCHEDULED JAVA Policy" -PermissionLevel gpoapply -TargetName $_ -TargetType Computer -Server MYUKVWHLDCDC03.hl.consfin.ge.com #...
PowerShellCorpus/Github/netzoft_PowerShell/RESAM_SQL2.ps1
RESAM_SQL2.ps1
<# Title: Extract RESAM agents from SQL DB Notes: LNGSTATUS:- 0 = "outdated/not in sync" , 1 = "uptodate in sync" Date: 24/08/2016 Version: 1.0 = Base Author: mark.zimmerman@ge.com #> $dataSource = "servername" $user = "username" $pwd = "password" $database = "database" $connection = New-Object Sys...
PowerShellCorpus/Github/netzoft_PowerShell/GetSOAPPostCode.ps1
GetSOAPPostCode.ps1
$a = Read-Host -Prompt '?Give me a first part of postcode.' $b = New-WebServiceProxy 'http://www.webservicex.net/uklocation.asmx?WSDL' $path=$b.GetUKLocationByPostCode($a) #======================================== Select-Xml -Content $path -XPath "//*" | select @{N="Name";E={$_.Node}},@{N="Value";E={$_.Node.Inn...
PowerShellCorpus/Github/netzoft_PowerShell/MyOutlook.ps1
MyOutlook.ps1
<# Add a new calendar item to a new Outlook folder called “SQL Server Agent Jobs” $outlook = new-object -com Outlook.Application $calendar = $outlook.Session.folders.Item(1).Folders.Item(“SQL Server Agent Jobs”) $appt = $calendar.Items.Add(1) # == olAppointmentItem $appt.Start = [datetime]”03/11/2010 11:00″ $appt....
PowerShellCorpus/Github/netzoft_PowerShell/GetFolderCheckPaths.ps1
GetFolderCheckPaths.ps1
$dialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog $dialog.AddExtension = $true $dialog.Filter = 'TXT (*.txt) | *.txt' $dialog.Title = 'Select a text file' $dialog.InitialDirectory = 'c:\temp' $result = $dialog.ShowDialog() $filename = $dialog.FileName $searchpath = Get-Content $filename ...
PowerShellCorpus/Github/netzoft_PowerShell/GetDiskFileSizeV4.ps1
GetDiskFileSizeV4.ps1
#Title: Gets file/folder object data File & Folder Count, Last writetime, Last Accesstime, Folder/File size and sends to csv report #Notes: Change variables as required- #takes 20seconds to process 1200 files in 283 folders totaling 90gb #it will run in the background and can be stopped anytime if required" #Ver...
PowerShellCorpus/Github/netzoft_PowerShell/DomainAuth Check.ps1
DomainAuth Check.ps1
Do { $cred = Get-Credential -UserName $env:username -Message "Type your HL domain credentials:" #Read credentials $username = $cred.username $password = $cred.GetNetworkCredential().password # Get current domain using logged-on user's credentials $domain = New-Object System.DirectoryServices.DirectoryEntry("...
PowerShellCorpus/Github/netzoft_PowerShell/mymapping-USER.ps1
mymapping-USER.ps1
##Date: 29/11/16 ##Version: 6.0 ##Title: Drive mapping management script for user logon ##Locally set execution policy on target machine for this script to run for user #Run this command from command prompt as Adminstrator: Powershell.exe Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -Force...
PowerShellCorpus/Github/netzoft_PowerShell/eval_ecopyfilesize-date.ps1
eval_ecopyfilesize-date.ps1
$ErrorActionPreference = "SilentlyContinue" $days=-180 $q=(get-date -DisplayHint Date).AddDays($days) #(gci c:\temp) | ? {$_.CreationTime -lt $q} | select -Property FullName,CreationTime $da=(get-date -DisplayHint Date).AddDays($days) $da2="01/01/2015" "{0:N2}" -f ( ( Get-ChildItem -Path \\com4000\e...
PowerShellCorpus/Github/netzoft_PowerShell/chartme-and-email.ps1
chartme-and-email.ps1
<#Script Attributes: Author: 110024293@ge.com Version: 2.1 Modified date: 03/08/2016 #> # load the appropriate assemblies [void][Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) [void][Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms.DataVisualization”) # create...
PowerShellCorpus/Github/netzoft_PowerShell/Time the command.ps1
Time the command.ps1
Write-Host (Measure-Command { gci }).Duration() "Time taken to complete"
PowerShellCorpus/Github/netzoft_PowerShell/Enumerate User Mapped drives and paths.ps1
Enumerate User Mapped drives and paths.ps1
gwmi -class win32_logicaldisk -Filter "providername>'\\'" | Select @{n="User";E={$env:Username}},@{n="DateTime";E={get-date}},PSComputerName,DeviceID,ProviderName | Export-Csv \\myukswhlwainf01\eut\PC4U_USERINFO_LOGS\User-Mapped-Drives\PS1-UserMaps.csv -NoTypeInformation -NoClobber -Append
PowerShellCorpus/Github/netzoft_PowerShell/process-waittostart.ps1
process-waittostart.ps1
$waitfor = "notepad" Write-Host (Measure-Command { Do {cls Write-Host "Waiting for" $waitfor"..." sleep -Milliseconds 500 ( gps $waitfor ) } Until (gps $waitfor ) }).Duration() "Time waiting for" $waitfor
PowerShellCorpus/Github/netzoft_PowerShell/Uniflow_Report.ps1
Uniflow_Report.ps1
$dialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog $dialog.AddExtension = $true $dialog.Filter = 'XML (*.xml) | StatExport*.xml' $dialog.Title = 'Select a STATEXPORT XML file' $dialog.InitialDirectory = '\\server\c$\program files (x86)\uniflow\webserver\xml' $result = $dialog.ShowDialog() $file...
PowerShellCorpus/Github/netzoft_PowerShell/Get-PST.ps1
Get-PST.ps1
del LH-*.csv -Force | Write-Verbose -Verbose #$LHUsers = get-content "C:\temp\LH-Users.txt" | select -Skip 1 $LHUsers = "\\homeserver\users5$\user1","\\homeserver\Users_IDM\user2","\\homeserver\users6$\user3","\\homeserver\Users6$\user4" 'Users on Legal Hold:' $LHUsers '---------------------------------------' ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/2SettingVars.ps1
2SettingVars.ps1
#Choose values to replace with variables [String]$ComputerName='Client' [String]$Drive='c:' Get-WmiObject -class Win32_logicalDisk -Filter "DeviceID='$Drive'" -ComputerName $ComputerName
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/DiskInfo.ps1
DiskInfo.ps1
# Making a function Function Get-DiskInfo{ [CmdletBinding()] param( [Parameter(Mandatory=$true)] [String]$ComputerName, [String]$Drive='c:' ) Get-WmiObject -class Win32_logicalDisk -Filter "DeviceID='$Drive'" -ComputerName $ComputerName | Select PSComputerName,...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/3Params.ps1
3Params.ps1
# add the Param block #[CmdletBinding()] param( [String]$ComputerName='Client', [String]$Drive='c:' ) Get-WmiObject -class Win32_logicalDisk -Filter "DeviceID='$Drive'" -ComputerName $ComputerName
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/JumpTools.ps1
JumpTools.ps1
Function Get-DiskInfo{ [CmdletBinding()] param( [Parameter(Mandatory=$true)] [String]$ComputerName, [String]$Drive='c:' ) Get-WmiObject -class Win32_logicalDisk -Filter "DeviceID='$Drive'" -ComputerName $ComputerName | Select PSComputerName, DeviceID, ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/2CompleteTemp.ps1
2CompleteTemp.ps1
<# .Synopsis Short description .DESCRIPTION Long description .EXAMPLE Example of how to use this cmdlet .EXAMPLE Another example of how to use this cmdlet .INPUTS Inputs to this cmdlet (if any) .OUTPUTS Output from this cmdlet (if any) .NOTES General notes .COMPONENT The componen...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/1StartCmd.ps1
1StartCmd.ps1
# Start with a command # I like to start in the console Get-WmiObject -class Win32_logicalDisk -Filter "DeviceID='C:'" -ComputerName 'localhost' # The new CIM version if you like Get-CimInstance -ClassName win32_logicalDisk -Filter "DeviceID='C:'" -ComputerName 'localhost' #Might even dress it up Get-WmiObject -...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod3/_Startup.ps1
_Startup.ps1
ise -file ".\1StartCmd.ps1, .\2SettingVars.ps1, .\3Params.ps1, .\DiskInfo.ps1, .\JumpTools.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod7/2Start.ps1
2Start.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/Mod7/4BettertryCatch.ps1
4BettertryCatch.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/Mod7/1erroraction.ps1
1erroraction.ps1
$ErrorActionPreference Get-WmiObject win32_bios -ComputerName DC,NotOnline,Client Get-WmiObject win32_bios -ComputerName DC,NotOnline,Client -EA SilentlyContinue -EV MyError $MyError Get-WmiObject win32_bios -ComputerName DC,NotOnline,Client -EA Stop Get-WmiObject win32_bios -ComputerName DC,NotOnline,Clie...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod7/Tempalte.ps1
Tempalte.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/Mod7/3SimpleTryCatch.ps1
3SimpleTryCatch.ps1
$Computer='notonline' Try{ $os=Get-Wmiobject -ComputerName $Computer -Class Win32_OperatingSystem ` -ErrorAction Stop -ErrorVariable CurrentError } Catch{ Write-warning "You done made a boo-boo with computer $Computer" }
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod7/_Startup.ps1
_Startup.ps1
ise -file ".\1erroraction.ps1, .\2Start.ps1, .\3SimpleTryCatch.ps1, .\4BettertryCatch.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/6MakeObjects.ps1
6MakeObjects.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [String[]]$ComputerName, #Switch to turn on Error logging [Switch]$ErrorLog, [String]$LogFile = 'c:\errorlog.txt' ) Begin{ If($errorLog){ Write-V...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/5MainCodeEnd.ps1
5MainCodeEnd.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [String[]]$ComputerName, #Switch to turn on Error logging [Switch]$ErrorLog, [String]$LogFile = 'c:\errorlog.txt' ) Begin{ If($errorLog){ Write-V...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/3testparamEnd.ps1
3testparamEnd.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [String[]]$ComputerName, #Switch to turn on Error logging [Switch]$ErrorLog, [String]$LogFile = 'c:\errorlog.txt' ) Begin{ If($errorLog){ Write...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/1SimpleTemp.ps1
1SimpleTemp.ps1
<# Comment based help #> Function Verb-Noun { [CmdletBinding()] Param( [Parameter()][String]$MyString, [Parameter()][Int]$MyInt ) Begin{<#Code#>} Process{<#Code#>} End{<#Code#>} }
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/4MainCodeStart.ps1
4MainCodeStart.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [String[]]$ComputerName, #Switch to turn on Error logging [Switch]$ErrorLog, [String]$LogFile = 'c:\errorlog.txt' ) Begin{ If($errorLog){ Write-V...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/2testparamStart.ps1
2testparamStart.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [String]$ComputerName, #Switch to turn on Error logging [Switch]$ErrorLog, [String]$LogFile = 'c:\errorlog.txt' ) Begin{} Process{} End{} }
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod4/_Startup.ps1
_Startup.ps1
ise -file ".\1SimpleTemp.ps1, .\2testparamStart.ps1, .\3testparamEnd.ps1, .\4MainCodeStart.ps1, .\5MainCodeEnd.ps1, .\6MakeObjects.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/4ParamAlias.ps1
4ParamAlias.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [Parameter(Mandatory=$True, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, HelpMessage= 'One or more computer names')] ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/7ParamPattern.ps1
7ParamPattern.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [Parameter(Mandatory=$True, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [String[]]$ComputerName, [ValidatePattern("\b\d{1,3}\...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/5ParamSet.ps1
5ParamSet.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [Parameter(Mandatory=$True, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [ValidateSet('DC','Client')] [String[]]$ComputerName, ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/3ParamHelp.ps1
3ParamHelp.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [Parameter(Mandatory=$True, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, HelpMessage= 'One or more computer names')] ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/2Pipeline.ps1
2Pipeline.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [Parameter(Mandatory=$True, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [String[]]$ComputerName, #Switch to turn on E...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/1Mandatory.ps1
1Mandatory.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers #[Parameter(Mandatory=$True)] [String[]]$ComputerName, #Switch to turn on Error logging [Switch]$ErrorLog, [String]$LogFile = 'c:\errorlog.txt' ) Begin{...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/6ParamCount.ps1
6ParamCount.ps1
Function Get-CompInfo{ [CmdletBinding()] Param( #Want to support multiple computers [Parameter(Mandatory=$True, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [ValidateCount(0,2)] [String[]]$ComputerName, ...
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod5/_Startup.ps1
_Startup.ps1
ise -file ".\1Mandatory.ps1, .\2Pipeline.ps1, .\3ParamHelp.ps1,.\4ParamAlias.ps1, .\5ParamSet.ps1, .\6ParamCount.ps1, .\7ParamPattern.ps1"
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/8For_Foreach.ps1
8For_Foreach.ps1
# Foreach - used often in our scripting for today $services = Get-Service ForEach ($service in $services) { $service.Displayname } #For loop For ($i=0;$i –lt 5;$i++) { #do something } #Another way 1..5 | ForEach-Object -process { Start calc }
PowerShellCorpus/Github/netzoft_PowerShell/Examples/2/Mod2/3ObjectMembers.ps1
3ObjectMembers.ps1
#Object Members and variables #Variables are very flexible $Service=Get-Service -Name bits $Service | GM $Service.Status $service.Stop() $Msg="Service Name is $($service.name.ToUpper())" $msg #Working with multiple objects $Services=Get-Service $services[0] $services[0].Status $Services[-1].Name "Service N...