How automatically set DSRM password or something like that via Powershell

function set-DSRMPass {
Begin {write-host „`n“
Write-Host -ForeGroundColor Yellow „Set new DSRM password …… “ ;
}
Process {

#$ntdspasschange = ‚ntdsutil „set dsrm password“ „reset password on server null“‚
#invoke-expression $ntdspasschange

$pass = Read-Host „password“ -AsSecureString
$wshell = New-Object -ComObject wscript.shell;
$wshell.Run(„cmd.exe“)
sleep 5
$wshell.SendKeys(‚ntdsutil‘)
$wshell.SendKeys(‚{ENTER}‘)
sleep 5
$wshell.SendKeys(‚set dsrm password‘)
$wshell.SendKeys(‚{ENTER}‘)
sleep 5
$wshell.SendKeys(„reset password on server null“)
$wshell.SendKeys(‚{ENTER}‘)
$wshell.SendKeys(„$pass“)
$wshell.SendKeys(‚{ENTER}‘)
sleep 5
$wshell.SendKeys(„$pass“)
$wshell.SendKeys(‚{ENTER}‘)
$wshell.SendKeys(‚q‘)
$wshell.SendKeys(‚{ENTER}‘)
$wshell.SendKeys(‚q‘)
$wshell.SendKeys(‚{ENTER}‘)
}
#ntdsutil „set dsrm password“ „reset password on server null“ q q

}

 

 

 

 

 

Powershell does not show all

Perhaps you have a same problem, which I have some minute ago. It is good time to write this show article and share with you how solve this trouble.

This is our problem:

PowershellNotShowAll

 

 

Solution is this variable – $formatenumerationlimit

When we set this variable to 200 -> $formatenumerationlimit = 200 , powershell will show us more. When I set variable to $formatenumerationlimit= -1, powershell will show us all

 

🙂