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 | |
Simulates pressing scroll lock to prevent idle. | |
.NOTES | |
Gathered from another source originally, unsure where | |
#> | |
[CmdletBinding()] | |
param ( | |
[Int]$Sleep = 240, |
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
$user="testerdouglas" | |
$finalResults = New-Object System.Object | |
$domain = "LDAP://ldap.example.com/ou=accounts,dc=example,dc=com" | |
$root = New-Object -TypeName System.DirectoryServices.DirectoryEntry($domain,$null,$null,"Anonymous") | |
$query = New-Object System.DirectoryServices.DirectorySearcher($root,"(&(objectclass=*)(uid=$($user)))") | |
$results = $query.findone() | |
$results.Properties |
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
$logPath = "C:\inetpub\logs\LogFiles\W3SVC1\" | |
$logFiles = [System.IO.Directory]::GetFiles($logPath, "*.log") | |
# $logs will store each line of the log files in an array | |
$logs = @() | |
# Skip the comment lines | |
$logFiles | % { Get-Content $_ | where {$_ -notLike "#[D,F,S,V]*" } | % { $logs += $_ } } | |
# Example search for HTTP 500 |
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
[datetime]$TodaysDate = Get-Date -format d | |
$LogPath = "c:\logs\" | |
$foundFiles = gci -Path $LogPath -Filter *.txt | where {($_.lastwritetime -lt $TodaysDate) -and ($_.lastwritetime -ge ($TodaysDate).adddays(-60))} | |
foreach ( $file in $foundFiles ) { | |
foreach($line in (Get-Content "$LogPath\$file" )) { | |
#write-host "testing $($line)." | |
if ($line -like "*joe*") { | |
write-host $line |
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
del /F /S /Q <target> | |
Deletes all files in target directory. Fastest, but will not get around permission issues or other stubborn file/folder issues, and also leaves behind directory structures. | |
rmdir /S /Q <target> | |
Helpful when removing an entire directory tree, and can be used to "clean up" the directory structures left behind from del command, but has same issues with certain files/folders. | |
robocopy <src> <target> /MIR | out-null |
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
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
// Use New-Guid for creating custom profiles | |
// https://github.com/microsoft/terminal/blob/master/doc/cascadia/SettingsSchema.md | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", |
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
$latest = (get-eventlog -LogName 'Application' -Source 'docker' -Newest 1).Index | |
while ($true) | |
{ | |
Start-Sleep -m 5000 | |
$tail = (get-eventlog -LogName 'Application' -Source 'docker' -Newest 1).Index | |
[int]$grab = $tail - $latest | |
if ($grab -gt 0) { | |
get-eventlog -LogName 'Application' -Source 'docker' -newest $grab | sort index | select Index, TimeGenerated, Message | |
$latest = $tail | |
} |
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
using System; | |
namespace FizzBuzz | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
for (int n = 1; n <101; n++){ | |
if (n%3 == 0) { |
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
$appPath = "testapp.exe" | |
# for testing with user account instead of MSA | |
$serviceAccount = whoami.exe | |
#serviceAccount = "DOMAIN\MyServiceAccount" | |
$taskName = "My Test Task" | |
$command = "-Command "". 'C:\apps\$appPath'""" | |
$action = New-ScheduledTaskAction -Execute $command |
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] | |
# Backends | |
[backends] | |
[backends.backend-myservice] | |
[backends.backend-myservice.servers] | |
[backends.backend-myservice.servers.primary] | |
url = "https://192.168.1.101:8181" |