How to join and unjoin a domain using poweshell in vb.net
Hello everyone,
I would like to join a domain using vb.net I want to insert this line in PowerShell after I launch it
I am using this code
' Process.Start("Powershell", "add-computer -domainname xxx -credential AD\xxx -restart -force" )
it's working for me but not asking to enter the username and the password for the domain
I found another code
Process.Start("powershell", "$domain = "MYDOMAIN.COM" + _
"$password = Read-Host -Prompt "Enter password For $user" -AsSecureString" + _
"$credential = New-Object System.Management.Automation.PSCredential($username,$password)" + _
"Add-Computer - DomainName $domain -Credential $credential"")
but it's not working at all
thanks in advanced
anonymous user
@Kareninstructor