Really struggling with trying to do this attempted this using a following code without both firing back RPC errors, I have tried enabling WMI and RPC and Remote assistance on the firewall, group policy and registry without any luck, am I missing something simply here?<\/p>\n
Add-Computer -ComputerName DESKTOP -DomainName test -NewName NEWNAME -Credential DOMAIN\\Administrator -PassThru -Verbose -Restart -Force\n<\/code><\/pre>\n$localCredential = Get-Credential -Message 'Enter Local Machine Creds'\n$remoteCredential = Get-Credential -Message 'Enter Domain Joining Creds'\n\n$cim = New-CimSession -ComputerName HOSTNAME -SessionOption (New-CimSessionOption -Protocol Dcom) -Credential $localCredential\n\nGet-CimInstance -ClassName Win32_ComputerSystem -CimSession $cim |\n Invoke-CimMethod -MethodName JoinDomainOrWorkgroup -Arguments @{\n FJoinOptions = 3\n Name = 'DOMAIN.local'\n UserName = $remoteCredential.UserName\n Password = $remoteCredential.GetNetworkCredential().Password\n }\n<\/code><\/pre>\n\n<\/code><\/pre>","upvoteCount":3,"answerCount":7,"datePublished":"2019-06-24T13:08:34.000Z","author":{"@type":"Person","name":"thecapt","url":"https://community.spiceworks.com/u/thecapt"},"suggestedAnswer":[{"@type":"Answer","text":"
Advertisement
Really struggling with trying to do this attempted this using a following code without both firing back RPC errors, I have tried enabling WMI and RPC and Remote assistance on the firewall, group policy and registry without any luck, am I missing something simply here?<\/p>\n
Add-Computer -ComputerName DESKTOP -DomainName test -NewName NEWNAME -Credential DOMAIN\\Administrator -PassThru -Verbose -Restart -Force\n<\/code><\/pre>\n$localCredential = Get-Credential -Message 'Enter Local Machine Creds'\n$remoteCredential = Get-Credential -Message 'Enter Domain Joining Creds'\n\n$cim = New-CimSession -ComputerName HOSTNAME -SessionOption (New-CimSessionOption -Protocol Dcom) -Credential $localCredential\n\nGet-CimInstance -ClassName Win32_ComputerSystem -CimSession $cim |\n Invoke-CimMethod -MethodName JoinDomainOrWorkgroup -Arguments @{\n FJoinOptions = 3\n Name = 'DOMAIN.local'\n UserName = $remoteCredential.UserName\n Password = $remoteCredential.GetNetworkCredential().Password\n }\n<\/code><\/pre>\n\n<\/code><\/pre>","upvoteCount":3,"datePublished":"2019-06-24T13:08:34.000Z","url":"https://community.spiceworks.com/t/remotely-join-a-pc-to-a-domain/717793/1","author":{"@type":"Person","name":"thecapt","url":"https://community.spiceworks.com/u/thecapt"}},{"@type":"Answer","text":"