I hereby claim:
- I am elvarb on github.
- I am elvarb (https://keybase.io/elvarb) on keybase.
- I have a public key ASDZzDklDOkPBni0NHij3M0aeVH49H1yZaym2TafaNWHSAo
To claim this, I am signing this object:
| # From https://stackoverflow.com/questions/42636510/convert-multiple-xmls-to-json-list | |
| # Use | |
| # [xml]$var = Get-Content file.xml | |
| # Convert to JSON with | |
| # $var | ConvertFrom-XML | ConvertTo-JSON -Depth 3 | |
| # Helper function that converts a *simple* XML document to a nested hashtable | |
| # with ordered keys. | |
| function ConvertFrom-Xml { | |
| param([parameter(Mandatory, ValueFromPipeline)] [System.Xml.XmlNode] $node) |
| # Modify start-sleep to change how frequent log lines should be generated | |
| # Modify out-file to change target log file | |
| # | |
| # Example output: | |
| # 2019-11-06 14:27:16 CHQvrjBqXbwFfUOgRc | |
| # 2019-11-06 14:27:16 RxEOpUqrjaIeLMzoiDyAHvg | |
| # 2019-11-06 14:27:17 DALVZYy | |
| # 2019-11-06 14:27:17 mjlSvTENJ | |
| # 2019-11-06 14:27:17 mHBtcDTuOZWqyKEFSdVzglMAivRjQpsw | |
| # 2019-11-06 14:27:17 QPMpZrhtsGcxyqwuBzHfmvaAkNgCe |
I hereby claim:
To claim this, I am signing this object:
| $username = "" # Github Username | |
| $key = "" # Github API key | |
| $goapp = "" # Go Project Name | |
| $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$key))) | |
| $deps = ((go list -f '{{ .Deps }}' $goapp).Trim('[',']')).split(' ') | |
| $deps | %{ | |
| write-host $_ |
| $goapp = 'myapp' | |
| ((go list -f '{{ .Deps }}' $goapp).Trim('[',']')).Replace(' '," `n") |
| Download the following | |
| * Logstash https://www.elastic.co/downloads/logstash | |
| * Java JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html | |
| * NSSM https://nssm.cc/ | |
| Create this folder structure | |
| \Logstash | |
| \Logstash\config | |
| \Logstash\java |
| import-module poshwsus | |
| connect-wsusserver WSUS.domain.com | |
| $nodes = Get-WSUSUpdateSummaryPerClient -ComputerScope (New-WSUSComputerScope) -UpdateScope (New-WSUSUpdateScope) | sort-object NeededCount -descending | select-object Computer,LastUpdated,NeededCount,InstalledPendingRebootCount,InstalledCount,FailedCount | |
| $emailto = "[email protected]" | |
| $emailfrom = "[email protected]" | |
| $message = $null |
| param( | |
| [string]$From = "[email protected]", | |
| $To = "[email protected]", | |
| [string]$Priority = "High", | |
| [string]$SMTPServer = "smtp.domain.com", | |
| $Encoding = [System.Text.Encoding]::UTF8, | |
| [string]$Subject = $(throw "Argument and value for '-Subject' is required."), | |
| [string]$Message = $(throw "Argument and value for '-Message' is required."), | |
| [string]$Attachments = "No" | |
| ) |
| $servers = "microsoft.com","google.com" | |
| $servers | %{ | |
| if (test-Connection -ComputerName $_ -Count 2 -Quiet ) { | |
| echo "$_ is online!" | |
| } else { | |
| $emailFrom = "[email protected]" | |
| $emailTo = "[email protected]" | |
| $subject = "$_ Is down!" | |
| $body = "Holy shit, you should do something about this." |