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
| import com.microsoft.sqlserver.jdbc.*; | |
| import java.sql.*; | |
| public class DBTest { | |
| public static void main(String[] args) { | |
| if (args.length != 1) { | |
| System.out.println("Please provide a connection string as an argument when calling this method; exactly 1 argument expected; received: " + args.length); | |
| return; |
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-IISLog { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(Mandatory, ValueFromPipeline)] | |
| [System.IO.FileInfo]$Path | |
| , | |
| [Parameter()] | |
| [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]$Encoding = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]::Ascii | |
| ) | |
| Begin { |
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
| $username = 'username' | |
| $password = 'password' | |
| $computer = $env:COMPUTERNAME | |
| Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' | |
| $obj = [System.DirectoryServices.AccountManagement.PrincipalContext]::new('machine',$computer) | |
| $obj.ValidateCredentials("$computer\$username", $password) |
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
| void Main() | |
| { | |
| var usr = @"myDomain\myUser"; | |
| var pwd = Util.GetPassword(usr); //linqpad util library | |
| var uri = "https://webdavendpoint.example.com/somefolder/"; | |
| var fn = @"c:\temp\filetouploadTestData.txt"; | |
| var rn = "remoteFilenameTestData.txt"; | |
| var wd = new BasicWebDavClient(usr, pwd, uri); | |
| wd.Put(fn, rn); |
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( | |
| [Parameter(Mandatory = $true)] | |
| [string]$ComputerName | |
| , | |
| [Parameter()] | |
| [int]$Port = 25 | |
| , | |
| [Parameter()] | |
| [System.Security.Authentication.SslProtocols]$SslProtocols = [System.Security.Authentication.SslProtocols]::GetValues([System.Security.Authentication.SslProtocols]) | |
| , |
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
| :: Recursively take ownership of all files under a folder, and amend their access to grant full ownership to admins. | |
| takeown /R /A /D Y /F c:\temp\path | |
| :: /R = Recursive | |
| :: /A = Ownership to Admins | |
| :: /D Y = answer Yes to any questions (/D N would answer No) | |
| :: /F c:\temp\path = which path to run the command against | |
| icacls c:\temp\path /grant Administrators:F /T /C | |
| :: c:\temp\path The path to run the command against |
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 Export-X509CertToPemFiles { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(Mandatory = $true)] | |
| [System.Security.Cryptography.X509Certificates.X509Certificate2]$Certificate | |
| , | |
| [Parameter(Mandatory = $true)] | |
| [System.IO.FileInfo]$FullChainPath | |
| , | |
| [Parameter(Mandatory = $true)] |
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
| ( | |
| resourcecontainers | |
| | where type =~ 'microsoft.resources/subscriptions' | |
| | project SubscriptionName=name, subscriptionId | |
| ) | join kind = inner | |
| ( | |
| resources | |
| | where type =~ 'microsoft.network/applicationgateways' | |
| | project subscriptionId, AppGateway=name, httpListeners = properties['httpListeners'] | |
| ) on subscriptionId |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | |
| <title>Google Demo</title> | |
| <style type="text/css" media="screen"> | |
| .rainbow-text { | |
| background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; |
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 Get-HttpUrlRedirects { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(Mandatory)] | |
| [ValidateNotNullOrEmpty()] | |
| [string]$Url | |
| , | |
| [Parameter()] | |
| [AllowNull()] | |
| [AllowEmptyString()] |