This file contains 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 Get-NetAccountInfo { | |
#obtain the data and do some minor cleanup | |
$data = net.exe accounts | |
$data = $data -replace '^[T].*','' | |
foreach ($line in $data) | |
{ | |
#split on double colon character | |
$line = $line -split '\:\s+' |
This file contains 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 Get-DaysLeftPwshSummit { | |
<# | |
Created By: Bill Kindle | |
Twitter: @BillKindle | |
Description: | |
This is just a simple function you can add to your PowerShell profile | |
as a reminder to register for PowerShell+DevOps Summit. |
This file contains 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 Start-PresentationMode { | |
# change certain colors to be friendlier to those with color blindness | |
Write-Host -ForegroundColor Yellow "Changing ERROR foreground color from RED >>> BLUE" | |
$Host.PrivateData.ErrorForegroundColor = "Blue" | |
Write-Host -ForegroundColor Yellow "Ghanging ERROR backround color >>> WHITE" | |
$Host.PrivateData.ErrorBackgroundColor = "white" | |
# Could add more here based on what colors are preferred but this is a start. |
This file contains 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 will only copy folder structure found in the $Source | |
path to the $Target path. | |
#> | |
# Adjust paths to suite needs | |
$Source = [path] | |
$Target = [path] | |
# This will only copy folders |
This file contains 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 is an exmaple of Infrastructure testing that can be done with Pester DSL and PowerShell | |
$nodes = @('node1','node2','node3','node4','node5') | |
Describe -Name 'Windows Appplication Service Infrastructure' -Tag 'Prod' { | |
Context -Name 'Application01 Service Checks' { | |
foreach ($node in $nodes) { |
This file contains 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
# These are moudles that I need to routinely save from the PowerShell Gallery | |
$modules = @("Pester","dbatools","dbachecks","psTrustedHosts","PoshWSUS","PSWindowsUpdate","PSDecode","PoshRSJob","PSFramework", | |
"ScheduledJobTools","WindowsCompatibility","ImportExcel","BurntToast","Invoke-CommandAs","PoshEvents") | |
$path = Read-Host -Prompt 'Please enter the full path to which you want to save common modules:' | |
Foreach ($module in $modules) { | |
Save-Module -Name $module -Path $path |
This file contains 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 link helped me solve the error I was recieving: | |
https://powershell.org/forums/topic/get-dnsserverresourcerecord-fails-on-dns-server/ | |
Big thanks to Logan B.! | |
#> | |
# Using a splatted array here, will make final cmd shorter! | |
$splat = @{ | |
Name = 'hostname' | |
ComputerName = 'DNSserverName' |
This file contains 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
# These are moudles that I need to routinely save from the PowerShell Gallery | |
$modules = @("Pester","dbatools","dbachecks","psTrustedHosts","PoshWSUS","PSWindowsUpdate","PSDecode","PoshRSJob","PSFramework", | |
"ScheduledJobTools","WindowsCompatibility","ImportExcel","BurntToast","Invoke-CommandAs","PoshEvents","psbbix","UniversalDashboard.Community") | |
$path = Read-Host -Prompt 'Please enter the full path to which you want to save common modules:' | |
Foreach ($module in $modules) { | |
Save-Module -Name $module -Path $path -AcceptLicense -Force | |
This file contains 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-LatestJRE.ps1 | |
Reference: | |
http://servertechs.info/automating-java-download-and-deployment-with-powershell-and-sccm/ | |
#> | |
# First I need to obtain some Uri's from Oracle. I'll sort them out, grabbing only the Windows Offline links | |
$Links = $(Invoke-WebRequest 'http://www.java.com/en/download/manual.jsp' -UserAgent 'Mozilla/5.0 (Windows NT 6.1; wow64)').links | | |
Where-Object -Property innerHTML -like 'Windows Offline*' | |
This file contains 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
# Send STDOUT to a string variable so it can be parsed later in a script | |
# WIP - Not fully tested yet | |
$StrOutput = [string] (& myApp.exe 2>&1) |
OlderNewer