Hi all,
just starting with powershell and need some help with the following. After installation of windows and autologon a window pops up to ask the new computer name and new domain name.
I startet like this:
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') $name = [Microsoft.VisualBasic.Interaction]::InputBox("Bitte neuen Computernamen eingeben:", "Name", "$env:username") $oComputerSystem = Get-WmiObject win32_computersystem $oComputerSystem.Rename( "$name" )
then reboot, autologon and runonce again to join the domain like
add-computer -domain dom1.test -OUPath "OU=computers,DC=dom1,DC=test" -cred $credential
Here my questions: - whats the best way when i input the domain to save it into a variable to have it after the reboot - how can use the credentials to automate the join domain (with a manual input during the command) - i assume its not possible without a reboot during rename and domain joining
Anyone can help me with some code oder samples?
cheers, Marco |