tshm
9/19/2015 - 12:42 PM

powershell template

powershell template

<#
  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


@findstr/v "^@f.*&" "%~f0"|powershell -&goto:eof
Write-Output "Hello World"