Skip to content

Instantly share code, notes, and snippets.

@Diagg
Diagg / GUI.ps1
Last active April 17, 2019 13:26
This example demonstrate how to build a 2 cents GUI by tricking cmdlet Show-Command
Function Install-WEBService
{
[CmdletBinding()]
Param
(
[Parameter(Position=0, Mandatory=$true, ParameterSetName='1-Settings')]
[String]$User,
[Parameter(Position=1,Mandatory=$true,ParameterSetName='1-Settings')]
[String]$Password,
@Diagg
Diagg / WebService.Ps1
Last active June 11, 2024 06:03
Simple PowerShell Web Service/Rest API
function New-ScriptBlockCallback
{
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
param(
[parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[scriptblock]$Callback
)
# Is this type already defined?
@Diagg
Diagg / TestReboot.wsf
Last active July 17, 2019 18:48
This script for MDT/SCCM demonstrate how to reboot to the same Task Séquence step wether you are on WinPE or Windows.
<job id="BIOSCheck">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
Option Explicit
RunNewInstance
Class TestReboot
Function Main
@Diagg
Diagg / Create-NatSwitch.ps1
Created November 29, 2017 00:31
Create a single nat switch for Windows 10 Hyper-V
$NatNicIP = '192.168.10.1'
$NatNicSubnet = '192.168.10.0'
$NatNicPrefixLenght = '24'
$NatName = 'Nat-Network'
New-VMSwitch -Name $NatName -SwitchType Internal
# Get the MAC Address of the VM Adapter bound to the virtual switch
$MacAddress = (Get-VMNetworkAdapter -ManagementOS -SwitchName Nat-Network).MacAddress