Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Stop-Service -DisplayName "Workstation" -force
- net use * /d
- Start-Service -Name "LanmanWorkstation"
- $dom = $env:userdomain
- $workgroupname = "WorkGroup"
- $domain = "$dom.local"
- $password = "Password1" | ConvertTo-SecureString -asPlainText -Force
- $username = "$domain\AddComp"
- $credential = New-Object System.Management.Automation.PSCredential($username,$password)
- Add-computer -WorkgroupName $workgroupname -Credential $credential
- Add-Computer -DomainName $domain -Credential $credential
- $Com1 = "---------------------------------------------------------"
- $Com2 = "| Attention! |"
- $Com3 = "| The server needs to restart to apply the last changes.|"
- $Com4 = "| Do NOT restart if the domain is incorrect! |"
- $Com5 = "---------------------------------------------------------"
- $Com6 = " "
- clear
- Write-Host $Com1
- Write-Host $Com2
- Write-Host $Com3
- Write-Host $Com4
- Write-Host $Com5
- Write-Host $Com6
- Write-Host "Check if domain match:"
- Write-Host $Com5
- Write-Host "Should be" = $domain
- Write-Host "Currently" = (Get-WmiObject Win32_ComputerSystem).domain
- Write-Host $Com5
- Restart-Computer -confirm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement