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
Get-WMIObject Win32_Printer | Where-Object { $_.Network -eq 'true' } | Foreach-Object { $_.delete() } |
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
//Regular Expressions List | |
//Short Tutorial | |
\ // the escape character - used to find an instance of a metacharacter like a period, brackets, etc. | |
. // match any character except newline | |
x // match any instance of x | |
^x // match any character except x | |
[x] // match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z | |
| // an OR operator - [x|y] will match an instance of x or y |
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 Import-Excel { | |
<# | |
.SYNOPSIS | |
Creates table-like custom objects from the items in a Excel file. | |
Requires Excel be installed! | |
.DESCRIPTION | |
The Import-Excel cmdlet creates table-like custom objects from the items in Excel | |
Worksheets. | |
Each column in the Excel Worksheet becomes a property of the custom object and the items in | |
rows become the property values. Import-Excel works on any file supported by Excel. |
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
# See what modules are installed -- lists multiple versions too | |
# Source: http://sharepointjack.com/2017/powershell-script-to-remove-duplicate-old-modules/ | |
Write-Host "this will report all modules with duplicate (older and newer) versions installed" | |
Write-Host "be sure to run this as an admin" -foregroundcolor yellow | |
Write-Host "(You can update all your Azure RMmodules with update-module Azurerm -force)" | |
$mods = Get-InstalledModule | |
foreach ($Mod in $mods) { |
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
# See what modules are installed -- lists multiple versions too | |
# Source: http://sharepointjack.com/2017/powershell-script-to-remove-duplicate-old-modules/ | |
Write-Host "this will report all modules with duplicate (older and newer) versions installed" | |
Write-Host "be sure to run this as an admin" -foregroundcolor yellow | |
Write-Host "(You can update all your Azure RMmodules with update-module Azurerm -force)" | |
$mods = Get-InstalledModule | |
foreach ($Mod in $mods) { |
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
-- SQL Server Dynamic Pivot Demo | |
-- Disclaimer | |
-- Part of this script is based on PIVOT samples I found somewhere on the net, | |
-- though most of this is my own work. | |
------------------------------------------------------------------------ | |
-- FIRST PHASE: Set up demo data in a table called dbo.MonthlySales | |
------------------------------------------------------------------------ |
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
# Originally published at https://gist.github.com/nzthiago/5736907 | |
# I Customized it for SPC14 with slides | |
# If you like it, leave me a comment | |
# If you don't like it, complain to Github. :) | |
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath | |
$rss = (new-object net.webclient) | |
# Grab the RSS feed for the MP4 downloads |
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
param ( | |
[string]$searchPath = "", | |
[string]$puttySession = "", | |
[string]$destPath = "" | |
) | |
# | |
# Init | |
# |
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
#h/t: http://tfl09.blogspot.com/2008/07/finding-your-external-ip-address-with.html | |
function getCurrentExternalIPAddress() { | |
$wc=New-Object net.webclient | |
$wc.downloadstring("http://checkip.dyndns.com") -replace "[^\d\.]" | |
} |
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
Imports System.Text.RegularExpressions | |
Imports System.Text | |
''' <summary> | |
'' 'Dynamic SQL parser | |
''' </summary> | |
''' <remarks></remarks> | |
Public Class DynamicSqlParser | |
''' <summary> | |
'' 'Create the DB command |
NewerOlder