Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am huzzeytech on github.
  • I am codyhuzz (https://keybase.io/codyhuzz) on keybase.
  • I have a public key ASB4Xh2WnoTtp9z4V7WYgr5KNFXBQKMcZbF2iNtuerRcgwo

To claim this, I am signing this object:

$userName = $args[0]
$password = $args[1]
$hostName = $args[2]
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
Function Validate-Credentials{
$principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext("Machine","$hostname")
$validate=$principalContext.ValidateCredentials($userName, $passWord)
if($validate) {
return $true
}
$username = $args[0]
$hostname = $args[1]
$currentPassword = $args[2]
$newPassword = $args[3]
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext("Machine", $hostName)
try
{
$User = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, "SamAccountName", $username)
$User.ChangePassword($currentPassword, $newPassword)
<#$userName = $args[0]
$password = $args[1]
$hostName = $args[2]
#>
$useName = admin
$password = "testing123"
$hostName = windows10
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
@huzzeytech
huzzeytech / Get-DomainAuth-Token.ps1
Created October 2, 2018 15:10
Sample auth with domain user in PowerShell to Secret Server
$application = "https://vault.thycotic.fun"
# Define the user credentials
$username = "domain\username";
$password = "password"; # Read-Host -Prompt "Enter your password: "
Function Get-Token
{
[CmdletBinding()]
Param(