Extension Name | Priority | Comments |
---|---|---|
PowerShell | 1 | Goes without saying |
PrintCode | 3 | If you share code via email and any copy/paste |
BlackBoard | 3 | If you like dark themes I prefer this one |
Share Code | 2 | Much betterr to share and post code |
Bracket Pari Colorizer | 2 | Very helpful for script editing and debugging |
Visual Studio Team Services |
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
Function Remove-CodeConfig { | |
<# | |
.NOTES | |
08.12.2018 JJK: TODO: Add the Whatif component of ShouldSupportProcess | |
#> | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] | |
Param () | |
# Check for existing config and data | |
If (Test-Path $env:APPDATA\Code -ErrorAction SilentlyContinue){ | |
# Remove from AppData |
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 | |
Installs base VSCode Extensions | |
.DESCRIPTION | |
Uses list of recommended extensions to start using VSCode with PowerShell. | |
.NOTES | |
=========================================================================== | |
Created with: Visual Studio Code | |
Created on: 08.12.2018 | |
Created by: Kavanagh, John J. |
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
Function show-installedmodules { | |
#Requires -Version 5 | |
[CmdletBinding()] | |
Param( | |
$varModules = (get-installedmodule) | |
) | |
Begin { | |
"-" * 52 | |
"`tReporting on {0} modules" -f $varModules.Count | |
"-" * 52 |
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
Function show-installedmodules { | |
<# | |
.SYNOPSIS | |
Lists Installed Modules and compares installed versions compared to online version | |
.DESCRIPTION | |
Uses list of installed modules via Get-InstalledModule, and compares them to current online version using | |
the Find-Module returned Version | |
.EXAMPLE | |
I ♥ PS > show-installedmodules | |
Example of how to use this Function |
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
Function show-installedmodules { | |
<# | |
.SYNOPSIS | |
Lists Installed Modules and compares installed versions compared to online version | |
.DESCRIPTION | |
Uses list of installed modules via Get-InstalledModule, and compares them to current online version using | |
the Find-Module returned Version. Place in profile to ensure it is loaded in all PowerShell sessions is | |
recommended. | |
.EXAMPLE | |
I ♥ PS > show-installedmodules |
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
{ | |
"Condition statement": { | |
"prefix": "cond", | |
"body": [ | |
"${_} { ${0}; break }" | |
], | |
"description": "Switch condition statement" | |
}, | |
"Credential Parameter": { | |
"prefix": "credparam", |
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
Function Publish-admcred { | |
Begin{ | |
$path = "$home\Desktop\mycred.json" | |
# Remove existing cred file if exists | |
if (test-path $path){Remove-Item $path -force} | |
} | |
Process{ | |
$cred = Get-Credential | |
$cred | | |
Select Username,@{n="Password"; e={$_.password | ConvertFrom-SecureString}} | |
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
$file = 'C:\etc\srv03sb.csv' | |
$computers = Import-Csv -Path $file -Header ComputerName, IPAdress, DNSServer1, DNSServer2, DNSServer3 | |
foreach ($computer in $computers) { | |
if(Test-Connection -ComputerName $computer.ComputerName -Count 1 -ea 0) { | |
try { | |
$Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $computer.ComputerName -EA Stop | ? {$_.IPEnabled} | |
} | |
catch { | |
Write-Warning "Error occurred while querying $computer." |
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
# Example of an inline filter and then a calculated expression | |
get-adcomputer -Filter {OperatingSystem -like "*Server*" -AND Name -like "PIT*"} | | |
Select-Object Name,@{n="online";e={test-connection -Computer $_.Name -Count 1 -Quiet}} |