Tag Archives: powershell

Changing a Domain Password When Paste Fails in PowerShell

While changing a domain administrator’s password in Windows PowerShell on a domain controller, I ran into a paste problem with Read-Host -AsSecureString. Typing a password manually worked, but pasting into the hidden prompt left the variable empty. Reading the clipboard with Get-Clipboard and converting its contents to a SecureString worked in the same session.

This is the procedure I used. It changes the password of the currently signed-in domain account and requires its existing password.

(more…)

Querying Active Directory with PowerShell

First run the following command as administrator to make Get-ADUser command work:

Get-WindowsCapability -Online | Where-Object {$_.Name -like "*ActiveDirectory.DS-LDS*"} | Add-WindowsCapability -Online
Path          :
Online        : True
RestartNeeded : False

Try the following commands:

$ad_ip = "10.15.7.15"
$ad_user = "administrator@itdrde.local"
Get-ADUser -Server $ad_ip -Credential $ad_user -Properties *
(more…)