Skip to content

Instantly share code, notes, and snippets.

View doctordns's full-sized avatar

Thomas Lee doctordns

View GitHub Profile
# ChatGPT was asked to create a script:
# "Write a powershell script to install AD and create users, groups, OUs and GPOs"
#
# This is what it came up with!
"Write a powershell script to install AD and create users, groups, OUs and GPOs"
this is what it came up with!
@doctordns
doctordns / Measure-HowLongRishi.ps1
Created October 26, 2022 09:54
How Long Until Rishi Is gone
# Measure-HowLongRishi.ps1
# A script to predecit when Rishi will be gone
# He started on Oct 25 2022
$StartDate = 'October 25 2022 10:30'
$Start = Get-Date $StartDate -DisplayHint Date
"It all started on [$($Start.datetime)]"
# When will it end?
$TheEnd = $Start.AddMonths(18) # He will be cone in 18 months
# This Gist is the code for the VM quick create article at:
# https://docs.microsoft.com/azure/virtual-machines/windows/quick-create-portal
# DoctorDNS@Gmail.Com
# Connect to Azure
Connect-AzAccount
# Create a new resource group
New-AzResourceGroup -Name MyResourceGroup -Location 'UKSouth'
@doctordns
doctordns / SecretsScriptForPSCommunityBlog.ps1
Last active February 22, 2022 06:13
Secrets Script For PS Community Blog
# Gist for Secrets Management PS Community Blog Post
# 1. Discover the modules
Find-Module -Name 'Microsoft.PowerShell.Secret*' |
Format-Table -Wrap -AutoSize
# 2. Install both modules
Install-Module -Name $Names -Force -AllowClobber
# 3. Examine them
@doctordns
doctordns / Set-VCSCodeEnvironment.ps1
Last active January 25, 2021 07:23
This Gist sets up VS Code after installation.
+# Setup-VSCodeEvironment.ps1
# (c) 2020 Thomas Lee (DoctorDNS@Gmail.Com)
# This Gist adds the Concordia Code font to Windows and configures VS Code
# This script is part of Thomas Lee's PowerShell 7 book published by Wiley
# If you are are seeking to reproduce the environment for PowerShell 7 to follow the book's contents,
# Run this script in VS Code, using PowerShell 7. Run this after you install each VM and after you have installed PowerShell 7.
# NB: This Gist uses PowerShell 7 features so you must run it either in VS COde or theConsole after
# Sample PowerShell 7 Profile File
# Copy the contents of this GIST to $Profile
# Meant to be a starting point.
# Greet the usser
"In Customiaations for: [$($Host.Name)]"
"For : [$(whomi)]"
"On ; [$(hostname)]"
# Set Me
@doctordns
doctordns / Install-PowerShell7Environment.ps1
Last active February 22, 2022 06:13
This Gist installs PowerShell 7 and VS Code. It also does some initial configuration for Powerhell 7.
# Set-PowerShell7Environment.ps1
# This Gist installs PowerShell 7 and VS Code
# Run this in Windows PowerShell 5.1 to bootstrap your way to Powerhell 7.
# This script is part of Thomas Lee's PowerShell 7 book published by Wiley
# If you are are seeking to reproduce the environment for PowerShell 7 to follow the book's contents,
# Run this script after you install each VM and before you start using the VM.
# 1. Set execution polity and install Nuget and PowerShellGet - Just in case
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force