This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| filter Get-InstalledSoftware { | |
| <# | |
| .SYNOPSIS | |
| Get all installed from the Uninstall keys in the registry. | |
| .DESCRIPTION | |
| Read a list of installed software from each Uninstall key. | |
| This function provides an alternative to using Win32_Product. | |
| .EXAMPLE | |
| Get-InstalledSoftware |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Function New-LabNCSI configures a server as IIS and DNS to support | |
| Network Connectivity Status Indicator (NCSI) scenarios for lab environments. | |
| .DESCRIPTION | |
| In some lab environments some machines really need to think they're on the internet, | |
| e.g. a Direct Access scenario. Most of my labs won't have internet access b/c I like to keep the VMs "sandboxed". | |
| This function helps you to turn a machine into a IIS- and DNS- | |
| Server simulating Microsofts Network Connectivity Status Indicator technique. | |
| To avoid touching the registry of the clients that will use this machine, the default MS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #requires -Version 3.0 | |
| Function Get-PublicIP { | |
| Invoke-RestMethod -Uri http://ipinfo.io/json | Select-Object -ExpandProperty 'ip' | |
| } | |
| #THX, @ipinfoio, https://ipinfo.io/developers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Script to install and configure a standalone RootCA for Lab-Environments | |
| .DESCRIPTION | |
| This Script sets up a standalone RootCA. It's main purpose is to save time when building Labs in the classes I teach. | |
| ###It's not meant for production!### | |
| First, it creates a CAPolicy.inf file. Then it deletes all default CDP and AIA and configures new ones. | |
| It turns on auditing and copys (It's a Lab!!!, so obviously no real offline RootCA...) the crt and crl to an edge webserver. | |
| .NOTES | |
| Author: Oliver Jäkel | [email protected] | @JaekelEDV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| The Function Export-MyVM extends the standard cmdlet Export-VM with dynamic parameters. | |
| .DESCRIPTION | |
| The Script makes the search for the VMs and the Export-Destination-Drive dynamic. | |
| You can simply tab through the two mandatory parameters to get (a) all VMs on the Hyper-V-Host and (b) all connected drives. | |
| Frankly, the main purpose was to learn dynamic parameters. | |
| .PARAMETER VMName | |
| Tab out all VMs on the Hyper-V-Host. | |
| It's a positional (1) and mandatory parameter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #region Check if System is DC and logged-on user is admin | |
| $DomainRole = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty DomainRole | |
| if( $DomainRole -match '4|5' ) | |
| #0=StandaloneWorkstation, 1=MemberWorkstation, 2=StandaloneServer, 3=MemberServer, 4=BackupDC, 5=PrimaryDC | |
| {Write-Host 'Check: Machine is DC' -ForegroundColor Green} | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #This script checks if all AD-relevant SRV-Records exist in DNS. Also it looks for netlogon.dns and the A-Record for the DC. | |
| $Domain = (Get-ADDomain).DNSRoot | |
| $DCName = (Get-ADDomainController).Name | |
| $msdcs = (Get-DnsServerResourceRecord -ZoneName _msdcs.$Domain -RRType Srv) | |
| $ARR = (Get-DnsServerResourceRecord -ZoneName $Domain -RRType A) | |
| $PDC = [string] "_ldap._tcp.pdc" | |
| $GC = [string] "_ldap._tcp.gc" | |
| $KDC = [string] "_kerberos._tcp.dc" | |
| $DC = [string] "_ldap._tcp.dc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Name | SamAccountName | UPN | GivenName | Surname | DisplayName | EmailAddress | Group | Department | |
|---|---|---|---|---|---|---|---|---|---|
| Jasper Beardley | Jasper | [email protected] | Jasper | Beardley | Jasper Beardley | [email protected] | Retired | Retired | |
| Patty Bouvier | Patty | [email protected] | Patty | Bouvier | Patty Bouvier | [email protected] | Bouvier | Bouvier | |
| Selma Bouvier | Selma | [email protected] | Selma | Bouvier | Selma Bouvier | [email protected] | Bouvier | Bouvier | |
| Kent Brockman | Kent | [email protected] | Kent | Brockman | Kent Brockman | [email protected] | |||
| Charles Montgomery Burns | Charles Montgomery | [email protected] | Charles Montgomery | Burns | Charles Montgomery Burns | [email protected] | Powerplant | Powerplant | |
| Carl Carlson | Carl | [email protected] | Carl | Carlson | Carl Carlson | [email protected] | Powerplant | Powerplant | |
| Maude Flanders | Maude | [email protected] | Maude | Flanders | Maude Flanders | [email protected] | Flanders | Flanders | |
| Ned Flanders | Ned | [email protected] | Ned | Flanders | Ned Flanders | [email protected] | Flanders | Flanders | |
| Rod Flanders | Rod | [email protected] | Rod | Flanders | Rod Flanders | [email protected] | Flanders | Flanders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Function Get-Sysinternals downloads Sysinternals Suite to a local folder. | |
| .DESCRIPTION | |
| Get-Sysinternals will | |
| - download the SysinternalsSuite.zip | |
| - unblock it | |
| - and decompress it to c:\sysinternals | |
| Check the Parameter Section for your desired paths! | |
| Using the .NET Class System.Net.WebClient for faster download. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Function Get-MACVendor returns the vendor for a given MAC-Address. | |
| .DESCRIPTION | |
| This script uses the API of https://macvendors.co. With Invoke-WebRequest (hence Version 3.0 is needed) it generates an output as xml. | |
| .PARAMETER MAC | |
| This is the only but mandatory parameter. Please enter a valid MAC-Address. | |
| It works both with colons or hyphens - you decide. | |
| .EXAMPLE | |
| Execute Get-MACVendor.ps1 directly from shell with dot sourcing |