full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-EnleverOptionChangerUtilisateur.ps1
Set-EnleverOptionChangerUtilisateur.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" $name = "HideFastUserSwitching" $val = "1" $type = "DWORD" New-ItemProperty $regKey -Name $name -Value $val -PropertyType $type -Force
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-RaccourciRedemarrer.ps1
Set-RaccourciRedemarrer.ps1
$WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$env:PUBLIC\Desktop\Redémarrer.lnk") $Shortcut.TargetPath = "Shutdown.exe" $Shortcut.Arguments = "-r -t 00" $Shortcut.IconLocation = "c:\Windows\system32\SHELL32.dll, 27" $Shortcut.Save()
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-EnleverOptionArretWindows.ps1
Set-EnleverOptionArretWindows.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" $name = "NoClose" $val = "1" $type = "DWORD" New-ItemProperty $regKey -Name $name -Value $val -PropertyType $type -Force
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-IntelPME.ps1
Set-IntelPME.ps1
# This function tests if a registry value exists, returning True if the value exists function Test-RegistryValue ([string] $key, [string] $name) { Get-ItemProperty -Path "$key" -Name "$name" -ErrorAction SilentlyContinue | Out-Null; return $?; } # List of Intel NICs that we want to check $IntelCar...
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-AjouterOptionArretWindows.ps1
Set-AjouterOptionArretWindows.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" $name = "NoClose" $val = "0" $type = "DWORD" New-ItemProperty $regKey -Name $name -Value $val -PropertyType $type -Force
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Get-AjouterOptionChangerUtilisateur.ps1
Get-AjouterOptionChangerUtilisateur.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" $name = "HideFastUserSwitching" $regValue = Get-ItemProperty $regKey $name -ErrorAction SilentlyContinue if(($? -and ($regValue -ne $null))) { $regValue.$name } else { # SCCM doesn't like when we return NULL values... -1 }
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-ComplianceCacheSCCM.ps1
Set-ComplianceCacheSCCM.ps1
$ErrorActionPreference = "SilentlyContinue" $size = 10240 $CCM = New-Object -com UIResource.UIResourceMGR ($ccm.GetCacheInfo()).totalsize = $Size
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-EnleverRaccourciRedemarrer.ps1
Set-EnleverRaccourciRedemarrer.ps1
Remove-Item "$env:PUBLIC\Desktop\Redémarrer.lnk" -Force
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Get-AjouterOptionArretWindows.ps1
Get-AjouterOptionArretWindows.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" $name = "NoClose" $regValue = Get-ItemProperty $regKey $name -ErrorAction SilentlyContinue if(($? -and ($regValue -ne $null))) { $regValue.$name } else { # SCCM doesn't like when we return NULL values... -1 }
PowerShellCorpus/Github/meterien_ConfigMgr/WakeOnLan/Send-WakeOnLan.ps1
Send-WakeOnLan.ps1
#SI(LOADPROXYFILE) # CHARGER LE FICHIER ## ### # Envoie un packet de mise en éveil Send-WOLPacket #PARAM Sous-réseau, MAC # Charger la configuration des proxy pour le fonctionnement inter-vlans Load-WolProxyConfiguration
PowerShellCorpus/Github/meterien_ConfigMgr/WindowsFeatures/Get-Windows10DefaultApps.ps1
Get-Windows10DefaultApps.ps1
param( [Parameter(Mandatory=$true)] [String]$path ) $Appx = Get-AppxPackage | select name $appx | Out-File -FilePath $path
PowerShellCorpus/Github/meterien_ConfigMgr/WindowsFeatures/Remove-Windows10DefaultApps.ps1
Remove-Windows10DefaultApps.ps1
$AppsList = @("Microsoft.BingFinance", "Microsoft.BingNews", "Microsoft.BingWeather", "Microsoft.XboxApp", "Microsoft.SkypeApp", "Microsoft.MicrosoftSolitaireCollection", "Microsoft.BingSports", "Micro...
PowerShellCorpus/Github/meterien_ConfigMgr/WindowsFeatures/Install-NetFX35.ps1
Install-NetFX35.ps1
$currentLocation = Split-Path -Parent $MyInvocation.MyCommand.Path; Enable-WindowsOptionalFeature -Online -FeatureName NetFx3 -Source $currentLocation -LimitAccess -All
PowerShellCorpus/Github/meterien_ConfigMgr/WindowsFeatures/Export-WindowsFileAssociations.ps1
Export-WindowsFileAssociations.ps1
param( [Parameter(Mandatory=$true)] [String]$path ) Start-Process -FilePath "Dism.exe" -ArgumentList "/online /Export-DefaultAppAssociations:$path\DefaultApps.xml" -Wait
PowerShellCorpus/Github/meterien_ConfigMgr/WindowsFeatures/Import-WindowsFileAssociations.ps1
Import-WindowsFileAssociations.ps1
param( [Parameter(Mandatory=$true)] [String]$file ) Start-Process -FilePath "Dism.exe" -ArgumentList "/online /Import-DefaultAppAssociations:$file" -Wait
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Set-IEStartPage.ps1
Set-IEStartPage.ps1
# Auteur : Josua Baril-Aumond # Date : 2015-10-07 # Description : Charge la ruche DefaultUser et appliquer des modifications param( [String]$IEStartPage = "www.google.ca" ) # Variables [String]$HKDefault = "HKU\DefaultProfile" [String]$HKNTUserDAT = "$env:SystemDrive\Users\Default\NTUSER.DAT" ...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Uninstall-ChromeExtension.ps1
Uninstall-ChromeExtension.ps1
# https://petermassa.com/?p=550 # ID # (Readability) = "oknpjjbmpnndlpmnhmekjpocelpnlfdi" param( [String]$appid ) if (Test-Path -Path HKLM:\Software\Policies\Google\Chrome) { # Already exists } else { New-Item -Path HKLM:\Software\Policies\Google -Name Chrome –Force } if (Test-Path -Path H...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Install-ChromeExtension.ps1
Install-ChromeExtension.ps1
# https://petermassa.com/?p=550 # ID # (Readability) = "oknpjjbmpnndlpmnhmekjpocelpnlfdi" param( [String]$appid ) if(-not (Test-Path -Path HKLM:\Software\Policies\Google\Chrome)) { New-Item -Path HKLM:\Software\Policies\Google -Name Chrome –Force } if (Test-Path -Path HKLM:\Software\Policies\Google\...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Install-MulticastApps.ps1
Install-MulticastApps.ps1
# - # Fonction : installer des applications depuis le disque dur à partir des Variables d'une sequence de taches. # Description : les fichiers sources sont stockés localement et les repertoires d'installation portent le nom # des applications sans espace, editeur ou version sauf exceptions # - # Josu...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Set-Win10DontUsePowershellOnWinX.ps1
Set-Win10DontUsePowershellOnWinX.ps1
param( [Parameter(Mandatory=$true)] [String]$Enable = $true ) # Get the current location $currentLocation = Split-Path -Parent $MyInvocation.MyCommand.Path # Replace CMD by Powershell when Win+X (0=Powershell and 1=CMD) $location = Get-Location & REG LOAD HKLM\DEFAULT C:\Users\Default\NTUSER.DAT Pu...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Set-Windows10EducationConfiguration.ps1
Set-Windows10EducationConfiguration.ps1
param( [Parameter(Mandatory=$true)] [String]$startLayout ) # Get the current location $currentLocation = Split-Path -Parent $MyInvocation.MyCommand.Path #New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DontUsePowerShellOnWinX" -PropertyType DWORD -Va...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Uptdate-ExcelApplicationList.ps1
Uptdate-ExcelApplicationList.ps1
# Must have access to ImportExcel module $sourceFolder = ".\Sources" $excelFile = ".\Applications.xlsx" Import-Module ".\Modules\ImportExcel" #--- TODO Take a backup a the file \\folder\file.date.hh.mm.ss.xslx #--- TODO Hash table for the fields names $softwareList = Import-Excel -Path $excelFile Wri...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Get-MDTApplicationFromConfigMgr.ps1
Get-MDTApplicationFromConfigMgr.ps1
# Must have ImportExcel module available param( $siteServer = "ConfigMgr01", $siteCode = "001", $udiCollection = "UDISoftwareCollection", $outputFile = ".\" ) $modulePath = ".\Modules\ImportExcel" if(Test-Path -Path $modulePath) { Import-Module $modulePath } $applications = @() $applicat...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/Set-Win10DisablePreviewDesktop.ps1
Set-Win10DisablePreviewDesktop.ps1
param( [Parameter(Mandatory=$true)] [String]$Enable = $true ) # Get the current location $currentLocation = Split-Path -Parent $MyInvocation.MyCommand.Path # Enable preview desktop (0=Enable and 1=Disable) if($Enable) { New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Exp...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/VisualRuntime/Get-CplusPlusRuntime.ps1
Get-CplusPlusRuntime.ps1
<# ################################################################################## # Script name: DownloadAll.ps1 # Created: 2012-12-26 # version: v1.0 # Author: Mikael Nystrom # Homepage: http://deploymentbunny.com/ #######################################################################...
PowerShellCorpus/Github/meterien_ConfigMgr/Applications/VisualRuntime/Install-CPlusPlusRuntime.ps1
Install-CPlusPlusRuntime.ps1
# - # Fonction : installer des runtime C++ depuis le disque dur. # Description : les fichiers sources sont stockés dans des repertoires ex: "Source\2005\vc2005.exe" # - # Josua Baril-Aumond # Modif : 2016-01-07 # # Permet de passer des parametres et d'accepter les parametres de bases ex: -Verbose [CmdletBinding...
PowerShellCorpus/Github/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/packages/WebGrease.1.5.2/tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) # Visual Studio execution done via NuGet Package Manager Function VSExecution($toolsPath, $project) { $project.DTE.ExecuteCommand("File.SaveAll", [system.string]::Empty) # Get the msbuild version of the project and add the import $msbuild = [Microsof...
PowerShellCorpus/Github/maxbyS_maxbyazure/Sources/packages/WebGrease.1.5.2/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) # Return a relative path with reference to root as Uri object # $rootPath - root path # $relativePath - relative path # $appendToRelativePath - Optional parameter. If provided will be appended to relative Path using Path.Combine() Function GetRelativeUri($root...
PowerShellCorpus/Github/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/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/maxbyS_maxbyazure/Sources/PublishScripts/Publish-WebApplicationWebsite.ps1
Publish-WebApplicationWebsite.ps1
#Requires -Version 3.0 <# .SYNOPSIS Creates and deploys a Microsoft Azure Website for a Visual Studio web project. For more detailed documentation go to: http://go.microsoft.com/fwlink/?LinkID=394471 .EXAMPLE PS C:\> .\Publish-WebApplicationWebSite.ps1 ` -Configuration .\Configurations\WebApplication1-WAWS-...
PowerShellCorpus/Github/bk222ap_KassaKvitto-Labb1.2/MyValuableCalculator/packages/jQuery.2.1.3/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/bk222ap_KassaKvitto-Labb1.2/MyValuableCalculator/packages/jQuery.2.1.3/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/bk222ap_KassaKvitto-Labb1.2/MyValuableCalculator/packages/jQuery.2.1.3/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/fferragina_SL/compare_csv_header.ps1
compare_csv_header.ps1
$path1 = "C:\Users\SL_HSR_1\Dropbox\project\SL\DH_OEV_20170114\" $path2 = "C:\Users\SL_HSR_1\Dropbox\project\SL\DH_OEV_20170128\" $files = Get-ChildItem -Path $Path1 -filter *.csv | Sort-Object Name ForEach ($file in $files){ Write-Host $file $file1 = $path1+$file $file2 = $path2+$file ...
PowerShellCorpus/Github/fferragina_SL/extract_header_2.ps1
extract_header_2.ps1
Get-Content .\DH_GPV_20170119_201701191200_Partner.csv | select -First 2 | out-file Partner.csv Get-Content .\DH_GPV_20170119_201701191200_AdresseDetails.csv | select -First 2 | out-file AdresseDetails.csv Get-Content .\DH_GPV_20170119_201701191200_PartnerIdentifikation.csv | select -First 2 ...
PowerShellCorpus/Github/fferragina_SL/import.ps1
import.ps1
Import-Module .\CsvSqlimport.psm1 Import-CsvToSql -Csv .\DH_OEV_20170114\VERTRAG14.csv -SqlServer HSR-7 -Database import -Delimiter "|" Import-CsvToSql -Csv .\DH_OEV_20170114\VERTRAGSTEIL14.csv -SqlServer HSR-7 -Database import -Delimiter "|" Import-CsvToSql -Csv .\DH_OEV_20170128\VERTRAG28.csv -SqlServer HSR-7 -D...
PowerShellCorpus/Github/fferragina_SL/extract_headern_1.ps1
extract_headern_1.ps1
Get-Content .\DH_GPV_20170123_201701232157_Partner.csv | select -First 1 | out-file Partner.csv Get-Content .\DH_GPV_20170123_201701232157_AdresseDetails.csv | select -First 1 | out-file AdresseDetails.csv Get-Content .\DH_GPV_20170123_201701232157_PartnerIdentifikation.csv | select -First 1 ...
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_D_Provision_2017_4_21_27_59_22/.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/will-lamm_Powershell-Projects/Solarwinds NodeCreation.ps1
Solarwinds NodeCreation.ps1
# This sample script demonstrates how to add a new node using CRUD operations and add WMI Polling. # Please update the hostname and credential setup to match your configuration, and # information about the node you would like to add for monitoring. Function Add-SWNode{ Param( [Parameter(Mandatory=$t...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/NPMInterfaces.ps1
NPMInterfaces.ps1
# This sample script demonstrates the use of two verbs provided for adding # NPM interfaces: # o Orion.NPM.Intefaces.DiscoverInterfacesOnNode # o Orion.NPM.Interfaces.AddInterfacesOnNode # # Note: These verbs are provided by SWISv3 only. # # The script lists all interfaces on a specified node and adds only # ...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/SearchGPOsForSetting.ps1
SearchGPOsForSetting.ps1
<<<<<<< HEAD # SearchGPOsForSetting.ps1 # # http://blogs.technet.com/b/grouppolicy/archive/2009/04/14/tool-images.aspx # http://blogs.technet.com/b/grouppolicy/archive/2009/04/17/find-settings-in-every-gpo.aspx # # Powershell script that does the following: # SearchGPOsForSetting.ps1 [–IsComputerConfiguration]...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/elevated ISE.ps1
elevated ISE.ps1
Start-Process powershell.exe -Credential “vuhl\will_lamm” -NoNewWindow -ArgumentList “Start-Process powershell_ISE.exe -Verb runAs”
PowerShellCorpus/Github/will-lamm_Powershell-Projects/SolarwindsTemplates.ps1
SolarwindsTemplates.ps1
# This sample script demonstrates the use of verbs provided for manipulating # applications and templates. The verbs are defined by "Orion.APM.Application" # and "Orion.APM.ApplicationTemplate" entity types. # # The script progresses in several steps: # 1. Creating a new application by assigning a template to a no...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Listbox.ps1
Listbox.ps1
function Select-Item { PARAM ( [Parameter(Mandatory=$true)] $options, [Parameter(Mandatory=$false)] $displayProperty ) Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing $form = New-Object System.Windows.Forms.Form $form.Text = "Data Entry Form" ...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds Properties.ps1
Solarwinds Properties.ps1
# This sample script demonstrates how to set a custom property of a node # or an interface using CRUD operations. # # Please update the hostname and credential setup to match your configuration, and # reference to an existing node and interface which custom property you want to set. #Needed Info $nodename...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds attempt 1.ps1
Solarwinds attempt 1.ps1
# This sample script demonstrates how to add a new node using CRUD operations and add WMI Polling. # Please update the hostname and credential setup to match your configuration, and # information about the node you would like to add for monitoring. #Region PSSnapin presence check/add if (-not (Get-PSSnapin -Name ...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Textlist.ps1
Textlist.ps1
function Select-TextItem { PARAM ( [Parameter(Mandatory=$False)] $options, $displayProperty ) [int]$optionPrefix = 1 # Create menu list foreach ($option in $options) { if ($displayProperty -eq $null) { Write-Host ("{0,3}: {1}" -f $o...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds/Solarwinds NodeCreation.ps1
Solarwinds NodeCreation.ps1
# This sample script demonstrates how to add a new node using CRUD operations and add WMI Polling. # Please update the hostname and credential setup to match your configuration, and # information about the node you would like to add for monitoring. Function Add-SWNode{ Param( [Parameter(Mandatory=$t...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds/NPMInterfaces.ps1
NPMInterfaces.ps1
# This sample script demonstrates the use of two verbs provided for adding # NPM interfaces: # o Orion.NPM.Intefaces.DiscoverInterfacesOnNode # o Orion.NPM.Interfaces.AddInterfacesOnNode # # Note: These verbs are provided by SWISv3 only. # # The script lists all interfaces on a specified node and adds only # ...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds/SolarwindsTemplates.ps1
SolarwindsTemplates.ps1
# This sample script demonstrates the use of verbs provided for manipulating # applications and templates. The verbs are defined by "Orion.APM.Application" # and "Orion.APM.ApplicationTemplate" entity types. # # The script progresses in several steps: # 1. Creating a new application by assigning a template to a no...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds/Solarwinds Properties.ps1
Solarwinds Properties.ps1
# This sample script demonstrates how to set a custom property of a node # or an interface using CRUD operations. # # Please update the hostname and credential setup to match your configuration, and # reference to an existing node and interface which custom property you want to set. #Needed Info $nodename...
PowerShellCorpus/Github/will-lamm_Powershell-Projects/Solarwinds/Solarwinds attempt 1.ps1
Solarwinds attempt 1.ps1
# This sample script demonstrates how to add a new node using CRUD operations and add WMI Polling. # Please update the hostname and credential setup to match your configuration, and # information about the node you would like to add for monitoring. #Region PSSnapin presence check/add if (-not (Get-PSSnapin -Name ...
PowerShellCorpus/Github/absmart_PowerShell/Orchestrator/Start-ServerSetup.ps1
Start-ServerSetup.ps1
<# .SYNOPSIS This script was used to start a System Center Orchestrator runbook and also perform some first-run tasks to setup a new server. If the UploadAuditResults variable is set to True, the remote system's details will be logged to the Servers list on the SharePoinUrl team site. .EXAMPLE In th...
PowerShellCorpus/Github/absmart_PowerShell/Orchestrator/Start-Runbook.ps1
Start-Runbook.ps1
<# This script is designed to be used to initiate a runbook using the Orchestrator web service URL. The GUID values are currently configured for the runbook "Toggle XA Application". #> Import-Module (Join-PATH $env:POWERSHELL_HOME "Libraries\General_Variables.psm1") Import-Module (Join-PATH $env:POWERSHELL_HOM...
PowerShellCorpus/Github/absmart_PowerShell/Orchestrator/Orchestrator_Functions.ps1
Orchestrator_Functions.ps1
Import-Module (Join-Path $ENV:POWERSHELL_HOME "Orchestrator\Modules\OrchestratorServiceModule.psm1") <# .SYNOPSIS This function is used to remotely start Orchestrator Runbooks. The ServiceURL is hardcoded, but can be changed to any of the other runbook servers as well. .EXAMPLE In this example, the Start-O...
PowerShellCorpus/Github/absmart_PowerShell/Query/Get-PendingReboot.ps1
Get-PendingReboot.ps1
Function Get-PendingReboot { <# .SYNOPSIS Gets the pending reboot status on a local or remote computer. .DESCRIPTION This function will query the registry on a local or remote computer and determine if the system is pending a reboot, from Microsoft updates, Configuration Manager Client SDK, Pending...
PowerShellCorpus/Github/absmart_PowerShell/Query/Get-AclData.ps1
Get-AclData.ps1
param( $Path, $ExportPath ) $Folders = Get-ChildItem $Path -Recurse | where-object {($_.PsIsContainer)} $Acl = $Folders | Get-ACL | Export-Csv -Path $ExportPath -NoTypeInformation
PowerShellCorpus/Github/absmart_PowerShell/Query/Get-PrivilegedUsers.ps1
Get-PrivilegedUsers.ps1
<# This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHA...
PowerShellCorpus/Github/absmart_PowerShell/Query/Get-IPInformationRemotely.ps1
Get-IPInformationRemotely.ps1
param( $ComputerName, [string] $ExportPath ) $Results = Invoke-Command -ComputerName $ComputerName -ScriptBlock{ $NetworkAdapter = Get-WmiObject Win32_NetworkAdapterConfiguration | where { -not [string]::IsNullorEmpty($_.IPAddress) -and $_.IPEnabled -eq $true -and $_.IpAddress -ne "0.0.0.0" } ...
PowerShellCorpus/Github/absmart_PowerShell/AWS/Add-AWSSecurityGroupWithPermissions.ps1
Add-AWSSecurityGroupWithPermissions.ps1
[CmdletBinding(DefaultParameterSetName="GroupName")] param( [Parameter(Mandatory=$true)] [System.String] $GroupName, [ValidateSet("TCP","UDP")] $Protocol = "TCP", [System.Int32] $Port, [ValidateScript({$_ -match "\b\d{1,2}.\b\d{1,2}.\b\d{1,2}.\b\d{1,2}/\b\d{1,2}"})] $...
PowerShellCorpus/Github/absmart_PowerShell/DSC/New-LCMConfiguration.ps1
New-LCMConfiguration.ps1
# The DSC configuration that will generate metaconfigurations [DscLocalConfigurationManager()] Configuration DscMetaConfigs { param ( [Parameter(Mandatory=$True)] [String]$RegistrationUrl, [Parameter(Mandatory=$True)] [String]$RegistrationKey, [Paramet...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-WebConfiguration.ps1
Create-WebConfiguration.ps1
param( [ValidateSet("Production","UAT","Development","QA","Test")] $Environment, [ValidateSet("CitrixServer","SharePointServer","ApplicationServer","WebServer","dotNetFarm")] $ServerType, $OutPath = $null, [ValidateSet("D:\","E:\","C:\")] $Drive = "E:\", $PublishToPullServer ) Import-Module...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Setup-DscBootStrap.ps1
Setup-DscBootStrap.ps1
<# .SYNOPSIS This script is used to remotely configure a system for a specific environment and server type based on pre-created LCM schema MOF configurations. The assumption is that a system is already on a domain, has remote PowerShell enabled, CredSSP enabled, etc. The initial vision of this script was to...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-cConfiguration.ps1
Create-cConfiguration.ps1
param( [ValidateSet("Production","UAT","Development","QA","Test")] $Environment, [ValidateSet("CitrixServer","SharePointServer","ApplicationServer","WebServer","dotNetFarm")] $ServerType, $ScriptSource, $Administrators, $PublishToPullServer ) # Set paths for Logs and Scripts $LogsPath = ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-devWebConfiguration.ps1
Create-devWebConfiguration.ps1
param( [ValidateSet("Production","UAT","Development","QA","Test")] $Environment, [ValidateSet("CitrixServer","SharePointServer","ApplicationServer","WebServer","dotNetFarm")] $ServerType, $OutPath = $null, [ValidateSet("D:\","E:\","C:\")] $Drive = "E:\", $PublishToPullServer ) Import-Module...
PowerShellCorpus/Github/absmart_PowerShell/DSC/DSC_Functions.ps1
DSC_Functions.ps1
$PullServer = "ServerNameHere" # Better to store this value in the Standard_Variables.psm1 module in the Libraries folder! function Test-RemoteExecution{ param( [Switch] $Enable ) foreach($Computer in $ComputerName){ $RemoteTest = Invoke-Command -ComputerName $Computer -ScriptBlock...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-devConfiguration.ps1
Create-devConfiguration.ps1
param( [ValidateSet("Production","UAT","Development","QA","Test")] $Environment, [ValidateSet("CitrixServer","SharePointServer","ApplicationServer","WebServer","dotNetFarm")] $ServerType, $Guid = $null, # No longer used, guid must be added to SP List [ValidateSet("D:\","E:\","C:\")] $Drive, # no lon...
PowerShellCorpus/Github/absmart_PowerShell/DSC/dsc-test-config.ps1
dsc-test-config.ps1
configuration webserver { Import-DscResource –ModuleName ’PSDesiredStateConfiguration’ Node green { File Test { Ensure = "Absent" DestinationPath = "C:\testgreen.txt" Type = "File" Contents = "Hello from Azure Automation DSC!" ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-AzureDscLcmConfiguration.ps1
Create-AzureDscLcmConfiguration.ps1
param( $ComputerName, $ConfigurationName ) if((Get-Module -Name AzureRm, AzureRm.Automation).Count -ne 2){ Import-AzureRM | Out-Null try{Get-AzureRmSubscription} catch{Login-AzureRmAccount} } [DscLocalConfigurationManager()] Configuration DscMetaConfigs { param ( ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Start-cConfiguration.ps1
Start-cConfiguration.ps1
<# .SYNOPSIS This script is used to perform initial configuration for a server to download and install the DSC private certificate, LCM and configure the LCM accordingly. Select the appropriate Environment and ServerType from the set of options. Updates to the script are required if additional options are requ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Webserver_Configuration_Ex01.ps1
Webserver_Configuration_Ex01.ps1
param( [ValidateSet("Production","UAT","Development","QA","Test")] $Environment, [ValidateSet("CitrixServer","SharePointServer","ApplicationServer","WebServer","dotNetFarm")] $ServerType, $Guid = $null, # No longer used, guid must be added to SP List [ValidateSet("D:\","E:\","C:\")] $Drive, # no lon...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Register-AzureDscNode.ps1
Register-AzureDscNode.ps1
param( $ComputerName ) [DscLocalConfigurationManager()] Configuration DscMetaConfigs { param ( [Parameter(Mandatory=$True)] [String]$RegistrationUrl, [Parameter(Mandatory=$True)] [String]$RegistrationKey, [Parameter(Mandatory=$True)] [...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-wConfiguration.ps1
Create-wConfiguration.ps1
$ConfigData= @{ AllNodes = @( @{ # The name of the node we are describing (or guid) NodeName = $Guid # Define this if this will be a Pull configuration, otherwise define $Guid as 'localhost'. #NodeName = "localhost" # Public certificate file used to en...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Setup-LocalConfigurationManager.ps1
Setup-LocalConfigurationManager.ps1
<# .SYNOPSIS This script is used to remotely configure a system for a specific environment and server type based on pre-created LCM schema MOF configurations. This script is used with the assumption that a system is already on a domain, has remote PowerShell enabled, CredSSP enabled, and other considerations. ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-DSCResource.ps1
Create-DSCResource.ps1
<# I use this to help create properties for new DSC resources and use the New-xDSCResource cmdlet to help generate the prerequisite files and folder structure. I don't have any goal to turn this into a real script or resource. #> Import-Module xDSCResourceDesigner # Create new DSC Resource and properties $R...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Setup-LocalConfigurationManagerWithCertificate.ps1
Setup-LocalConfigurationManagerWithCertificate.ps1
<# .SYNOPSIS This script is used to remotely configure a system for a specific environment and server type based on pre-created LCM schema MOF configurations. This script is used with the assumption that a system is already on a domain, has remote PowerShell enabled, CredSSP enabled, and other considerations. ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/Create-LCMConfigurations.ps1
Create-LCMConfigurations.ps1
param( $Guid, $OutFilePath, $CertificateID = "aec59442276e898faf63859dd94d2ee5e2d33071", $PullServer, $CopyToPullServer ) Set-Location $env:DSC_HOME\LCMConfigurations configuration cConfiguration { LocalConfigurationManager { AllowModuleOverwrite = $true ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/AzureAutomationDSC/TestConf.ps1
TestConf.ps1
configuration ModuleTest { node AzureDscVm { File Web { Ensure = "Present" DestinationPath = "C:\Web" Type = "Directory" } WindowsFeature Web { Ensure = "Present" ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Setup-DscPullServer.ps1
Setup-DscPullServer.ps1
# Copy resources to pull server. Adjust this to the path to the Resources directory that is appropriate. Copy-Item $env:POWERSHELL_HOME\DSC\Resources # Variables - Change these to your preferences. $DnsName = "Dsc Credential Certificate" $PfxPassword = ConvertTo-SecureString -String "SUPERCOMPLEXEPASSWORDHE...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/Examples/Sample_InstallMSIProductId_xPackage.ps1
Sample_InstallMSIProductId_xPackage.ps1
<# Simple installer that installs an msi package and matches based on the product id. #> param ( [String]$OutputPath = ".", [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $PackageName, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $S...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/Examples/Sample_InstallExeCreds_xPackage.ps1
Sample_InstallExeCreds_xPackage.ps1
<# Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. #> param ( [String]$OutputPath = ".", [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $PackageName, [parameter(Mandatory = $true)] [ValidateNo...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/Examples/Sample_InstallMSI_xPackage.ps1
Sample_InstallMSI_xPackage.ps1
<# Simple installer for an msi package that matches via the Name. #> param ( [String]$OutputPath = ".", [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $PackageName, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $SourcePath ) Conf...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1
Sample_InstallExeCredsRegistry_xPackage.ps1
<# Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. This sample also uses custom registry data to discover the package. #> param ( [String]$OutputPath = ".", [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xServiceResource/Samples/Sample_xService_DeleteService.ps1
Sample_xService_DeleteService.ps1
Configuration Sample_xService_DeleteService { param ( [string[]] $nodeName = 'localhost', [System.String] $Name, [System.String] [ValidateSet("Automatic", "Manual", "Disabled")] $StartupType, [System.String] [Validate...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xServiceResource/Samples/Sample_xService_ServiceWithCredential.ps1
Sample_xService_ServiceWithCredential.ps1
Configuration Sample_xService_ServiceWithCredential { param ( [string[]] $nodeName = 'localhost', [System.String] $Name, [System.String] [ValidateSet("Automatic", "Manual", "Disabled")] $StartupType="Automatic", [System.String...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xServiceResource/Samples/Sample_xService_CreateService.ps1
Sample_xService_CreateService.ps1
Configuration Sample_xService_CreateService { param ( [string[]] $nodeName = 'localhost', [System.String] $Name, [System.String] [ValidateSet("Automatic", "Manual", "Disabled")] $StartupType="Automatic", [System.String] ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xProcessResource/Samples/Sample_xWindowsProcess_EnsureAbsentWithCredential.ps1
Sample_xWindowsProcess_EnsureAbsentWithCredential.ps1
Configuration Sample_xWindowsProcess_EnsureAbsentWithCredential { param ( [pscredential]$cred = (Get-Credential) ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration Node localhost { xWindowsProcess Notepad { Path = "C:\Windows\System32\Not...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xProcessResource/Samples/Sample_xWindowsProcess_ArgumentsWithCredential.ps1
Sample_xWindowsProcess_ArgumentsWithCredential.ps1
Configuration Sample_xWindowsProcess_ArgumentsWithCredential { param ( [pscredential]$cred = (Get-Credential) ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration Node localhost { xWindowsProcess powershell { Path = "C:\Windows\System32\Win...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/DSCResources/MSFT_xProcessResource/Samples/Sample_xWindowsProcess_WithCredential.ps1
Sample_xWindowsProcess_WithCredential.ps1
Configuration Sample_xWindowsProcess_WithCredential { param ( [pscredential]$cred = (Get-Credential) ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration Node localhost { xWindowsProcess Notepad { Path = "C:\Windows\System32\Notepad.exe" ...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/Examples/Test_Sample_xArchive_CompressMultipleDirs.ps1
Test_Sample_xArchive_CompressMultipleDirs.ps1
$zipFilePath = "$pwd\Target.zip" del "$pwd\SourceDir-1" -Force -Recurse -ErrorAction SilentlyContinue del "$pwd\SourceDir-2" -Force -Recurse -ErrorAction SilentlyContinue New-Item $pwd\SourceDir-1 -Type Directory | Out-Null New-Item $pwd\SourceDir-1\Sample-1.txt -Type File | Out-Null New-Item $pwd\SourceDir-...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/Examples/Test_Sample_xArchive_ExpandArchive.ps1
Test_Sample_xArchive_ExpandArchive.ps1
$zipFilePath = "$pwd\SampleArchive.zip" $expandedZipDir = "$pwd\TargetExpanded" del "$pwd\SourceDir" -Force -Recurse -ErrorAction SilentlyContinue del "$zipFilePath" -Force -Recurse -ErrorAction SilentlyContinue New-Item $pwd\SourceDir -Type Directory | Out-Null New-Item $pwd\SourceDir\Sample-1.txt -Type Fil...
PowerShellCorpus/Github/absmart_PowerShell/DSC/PullServerSetup/Modules/xPSDesiredStateConfiguration/Examples/Sample_xService_DeleteService.ps1
Sample_xService_DeleteService.ps1
Configuration Sample_xService_DeleteService { param ( [string[]] $nodeName = 'localhost', [System.String] $Name, [System.String] [ValidateSet("Automatic", "Manual", "Disabled")] $StartupType, [System.String] [Validate...