Skip to content

Instantly share code, notes, and snippets.

View Stephanevg's full-sized avatar
:shipit:
I like computers

Stéphane Stephanevg

:shipit:
I like computers
View GitHub Profile
@Stephanevg
Stephanevg / PsModulePathVariableManagement.ps1
Last active October 5, 2022 13:09
functions to add / remove paths to the $psmodulePath environment variable.
function Remove-FromPSModulePath{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)][String]$Path="C:\admin\modules"
)
if ($env:PSModulePath.split(";") -contains $Path){
$NewValue = (($env:PSModulePath).Split(";") | ? { $_ -ne $Path }) -join ";"
[Environment]::SetEnvironmentVariable("PSModulePath", $NewValue, "Machine")
$env:PSModulePath = [System.Environment]::GetEnvironmentVariable("PSModulePath","Machine")
write-verbose "$Path removed. Restart the prompt for the changes to take effect."
@Stephanevg
Stephanevg / Get-ClassConstructors.ps1
Created May 14, 2017 16:27
Return class constructors
function Get-ClassConstructors {
Param(
$ClassName
)
$v = [$ClassName].GetConstructors() | % {$_.GetParameters()} | select member,Name,defaultvalue
return $v
}
@Stephanevg
Stephanevg / Error log packer hyperv & winrm communicator
Last active June 21, 2017 22:03
Error log packer hyperv & winrm communicator
PS C:\Users\taavast3\OneDrive\Scripting\Packer> .\packer.exe build .\hyperv.json
2017/06/21 23:32:11 Using internal plugin for amazon-ebssurrogate
2017/06/21 23:32:11 Using internal plugin for amazon-instance
2017/06/21 23:32:11 Using internal plugin for hyperv-iso
2017/06/21 23:32:11 Using internal plugin for oneandone
2017/06/21 23:32:11 Using internal plugin for parallels-pvm
2017/06/21 23:32:11 Using internal plugin for qemu
2017/06/21 23:32:11 Using internal plugin for virtualbox-iso
2017/06/21 23:32:11 Using internal plugin for alicloud-ecs
2017/06/21 23:32:11 Using internal plugin for amazon-chroot
@Stephanevg
Stephanevg / packer hyperv
Last active June 27, 2017 06:58
Packer hyperv
{
"variables": {
"PACKER_LOG": "1",
"PACKER_LOG_PATH": "packerlog.txt"
},
"Builders": [{
"type": "hyperv-iso",
"iso_url": "C:\\Users\\taavast3\\Downloads\\en_windows_server_2012_r2_with_update_x64_dvd_6052708 (1).iso",
"iso_checksum": "8E98E65389E8353186356C96B3A26DD1",
"iso_checksum_type": "md5",
@Stephanevg
Stephanevg / Packer error log Halting machine gracefully.log
Last active June 27, 2017 07:52
Packer error log Halting machine gracefully
2017/06/27 08:14:32 [INFO] Packer version: 1.0.2
2017/06/27 08:14:32 Packer Target OS/Arch: windows amd64
2017/06/27 08:14:32 Built with Go Version: go1.8.3
2017/06/27 08:14:32 Using internal plugin for parallels-pvm
2017/06/27 08:14:32 Using internal plugin for digitalocean
2017/06/27 08:14:32 Using internal plugin for oneandone
2017/06/27 08:14:32 Using internal plugin for cloudstack
2017/06/27 08:14:32 Using internal plugin for googlecompute
2017/06/27 08:14:32 Using internal plugin for null
2017/06/27 08:14:32 Using internal plugin for triton
@Stephanevg
Stephanevg / Profile.ps1
Created June 30, 2017 07:41
windows powershell profile
function prompt
{
# The at sign creates an array in case only one history item exists.
$history = @(get-history)
if($history.Count -gt 0)
{
$lastItem = $history[$history.Count - 1]
$lastId = $lastItem.Id
}
@Stephanevg
Stephanevg / settings.json
Last active July 17, 2017 12:44
vscode user settings
{
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
"workbench.colorTheme": "PowerShell ISE",
"workbench.iconTheme": "vscode-great-icons",
"editor.fontSize": 16,
"files.defaultLanguage": "powershell",
"editor.autoClosingBrackets": true,
"editor.autoIndent": true,
"powershell.codeFormatting.preset" : "OTBS"
}
@Stephanevg
Stephanevg / readme.md
Created July 25, 2017 12:27
Bug VS code Readme.md display breaks after adding to staging area

Documentation for SDB-OPR-GenerateTaskScheduleCSVInputFile.ps1

Email LastModifiedDate Author CreationDate
  |  25.07.2017      |  Stephane van Gulick |  25.07.2017 

Script History

date Comment Name
@Stephanevg
Stephanevg / FunctionNotClosing.ps1
Last active July 27, 2017 09:50
VSCODE BUG: Code blocks do not close correctly.
function Write-ChangeLog {
[Cmdletbinding()]
param (
[Parameter(Mandatory=$true)][String]$Message
)
$ChangeLogWriter = "C:\Admin\Tools\ChangeLogWriter\ChangeLogWriter.exe"
if (Test-Path $ChangeLogWriter) {
Write-Log -Message "Write to the ChangeLogWriter" -Status INFO
@Stephanevg
Stephanevg / Get-ClusterDataStore.ps1
Last active August 4, 2017 13:53
Returns the Storage Pods that are attached to a specefic cluster
Function Get-ClusterDataStore {
<#
.SYNOPSIS
Retrieves the datastores that are attached to a cluster
.DESCRIPTION
Returns
.EXAMPLE