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 FormatAuditTokens($text) | |
{ | |
$text -Replace "%%1541", "SYNCHRONIZE" ` | |
-Replace "%%4421", "Execute/Traverse" ` | |
-Replace "%%1805", "Not granted" ` | |
-Replace "%%4423", "ReadAttributes" ` | |
-Replace "%%4416", "ReadData (or ListDirectory)" ` | |
-Replace "%%1537", "DELETE" ` | |
-Replace "%%1538", "READ_CONTROL" ` | |
-Replace "%%1542", "ACCESS_SYS_SEC" ` |
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
$serviceName = "OctopusDeploy" | |
$cmd = "sc.exe config $serviceName depend= " | |
(Get-Service $serviceName | Select -ExpandProperty ServicesDependedOn) | % {$cmd += $_.Name + "/"} | |
$cmd += "MSSQLSERVER" | |
$cmd | |
Invoke-Expression $cmd -Verbose | |
Get-Service $serviceName | Select * |
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
$e = Get-WinEvent -FilterHashtable @{logname='System';id=6005,6006} | Select TimeCreated,Message | |
$o = Get-WinEvent -FilterHashtable @{logname='System';id=7036;data='OctopusDeploy'} | Select TimeCreated,Message | |
($e+$o) | Sort TimeCreated |
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
Console.WriteLine("abedef".LastIndexOf("e","abedef".LastIndexOf("e")-1)); | |
// --> 2 | |
// Yes, a bit dirty, but if you use a regex then you'll have two problems. |
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 CheckIsEnabled($description, $path, $name = "Enabled", [switch]$failIfEnabled) | |
{ | |
if((Test-Path $path) -eq $false) { | |
Write-Host "$description is DISABLED due to non existent setting" | |
return | |
} | |
$property = Get-ItemProperty $path -name $name -ErrorAction SilentlyContinue | |
if($property -and $property.$name -ne 0) | |
{ |
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
$fileName = "C:\Temp\SomeImage.png" | |
[Convert]::ToBase64String((Get-Content $fileName -Encoding Byte)) | Set-Content ($fileName + ".b64") -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
CLEAR | |
$webUrl = "https://cibs.afcorp.afg" | |
Write-Host "Getting certificate for $weburl" | |
$request = [Net.WebRequest]::Create($webUrl) | |
$request.GetResponse() | Out-Null | |
$cert = $request.ServicePoint.Certificate | |
Write-Host "Getting chain" |
https://{YOUR CRUCIBLE URL}/changelog-ajax/{REPOSITORY.NAME}?q=&limit=51&command=branches
That will return something looking like:
{
totalItems: 5,
hasQuerySpecified: false,
items: [
{