Last active
August 5, 2016 04:38
-
-
Save tshm/5c2e3d228874d29af773 to your computer and use it in GitHub Desktop.
powershell template
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
@findstr/v "^@f.*&" "%~f0"|powershell -&goto:eof | |
Write-Output "Hello World" |
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
<# | |
template | |
#> | |
Function Log($obj) { | |
Write-Output ($obj | Format-Table | Out-String) | |
Write-Debug -Message "message!!" | |
} | |
Function SHA512([String] $str) { | |
$algorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA512") | |
$enc = [system.Text.Encoding]::UTF8 | |
$bytes = $algorithm.ComputeHash($enc.GetBytes($str)) | |
return -Join ($bytes | ForEach {"{0:X2}" -f $_}) | |
} | |
$path = "HKLM:\\SYSTEM\\" | |
$key = "testKey" | |
New-ItemProperty -Path $path -Name $key -PropertyType DWORD -Value 1 -Force | |
net user TestAdmin Abcd123 /add | |
net localgroup TestAdmin administrators /add | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment