This topic contains 5 replies, has 2 voices, and was last updated by
April 25, 2014 at 4:00 am #14814
i want to use the command Remove-Computer to unjoin computers from domain.
I use this command :
Remove-Computer -UnjoinDomainCredential C_NET\Administrateur -ComputerName VSMW0020 -Force -Restart
Unjoin domain works, but not the restart :
Remove-Computer : Impossible de redémarrer l'ordinateur VSMW0020 avec le message d'erreur suivant : Accès refusé .
Au caractère Ligne:1 : 1
+ Remove-Computer -UnjoinDomainCredential C_NET\Administrateur -ComputerName VSMW ...
+ CategoryInfo : OperationStopped: (VSMW0020:String) [Remove-Computer], InvalidOperationException
+ FullyQualifiedErrorId : RestartcomputerFailed,Microsoft.PowerShell.Commands.RemoveComputerCommand
Can someone help?
April 25, 2014 at 4:02 am #14815
Command launched from a 2K8 R2 with powerhsell V3, targeted computers are XP and Win7
April 25, 2014 at 4:07 am #14816MemberPoints: 0Rank: Member
It's an Access Denied error. Is the account that's running the command also an administrator on the target computer? If not, you'll also need to use the -LocalCredential parameter in addition to -UnjoinDomainCredential. (You can pass the same credentials to both parameters, if appropriate.)
April 25, 2014 at 4:18 am #14817
This account is domain administrator, isn't enough?
April 25, 2014 at 5:23 am #14820MemberPoints: 0Rank: Member
Which account? There are two sets of credentials in play, in the original command you posted. C_NET\Administrateur is used to connect to the domain controller and perform that part of the unjoin process. To connect to the VSMW0020 computer, though, the cmdlet is just using the credentials of whatever user is logged on and running the command. To use the C_NET\Administrateur account for both parts of the operation, you'd do something like this:
$cred = Get-Credential C_NET\Administrateur Remove-Computer -UnjoinDomainCredential $cred -LocalCredential $cred -ComputerName VSMW0020 -Force -Restart
April 25, 2014 at 5:54 am #14823
IT WORKS !!!!!!!!!!!!!!!
The topic ‘Remove-Compter : Restart doesn't work’ is closed to new replies.