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
do { | |
# set variables for searching Service.log | |
$now = Get-Date -Format 'yyyy-MM-dd' | |
$log = 'C:\Users\wkindle\Desktop\Service_Test.log' | |
$logstr = 'updating status to READY' | |
Write-Output "Searching for READY status" | |
# using this to create a timeout counter |
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
When, in the course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume, among the powers of the earth, the separate and equal station to which the laws of nature and of nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation. | |
We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable rights, that among these are life, liberty, and the pursuit of happiness. That, to secure these rights, governments are instituted among men, deriving their just powers from the consent of the governed. That, whenever any form of government becomes destructive of these ends, it is the right of the people to alter or to abolish it, and to institute new government, laying its foundation on such principles, and organizing its powers in such form, as to them shall seem most li |
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
# Any URL you want to test | |
$url = 'https://www.google.com' | |
# This will gather everything but that's OK | |
$http = (Invoke-WebRequest -Uri $url) | |
# I'm using the $http object membertype property to get the status code | |
Write-Output $http.StatusCode |
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
# Courtesy of https://www.sconstantinou.com/powershell-try-catch-finally/ | |
# A great PowerShell blogger, Stephanos Constantinou | |
([appdomain]::CurrentDomain.GetAssemblies() | | |
Where-Object {$_.Location -ne $null} | | |
foreach {$_.GetExportedTypes() | | |
Where-Object {$_.Fullname -match 'Exception'}}).FullName |
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) |
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
# 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
<# 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") | |
$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 |
NewerOlder