From c309393ebc7d52fa87b285e2874082f477eeb0ba Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 16 Sep 2022 01:09:50 -0400 Subject: [PATCH] Wait for RPC Service before joining domain --- Set-ComputerName.ps1 | 3 +++ autounattend.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Set-ComputerName.ps1 b/Set-ComputerName.ps1 index 2619de9..376f13b 100755 --- a/Set-ComputerName.ps1 +++ b/Set-ComputerName.ps1 @@ -26,6 +26,9 @@ If ($Null -eq $NewComputerName) { $cred = New-Object System.Management.Automation.PsCredential("SAWTOOTH\Administrator", (ConvertTo-SecureString "REPLACE_WITH_PASSWORD" -AsPlainText -Force)) +Write-Host "Waiting for RPC Service" +(Get-Service RpcSs).WaitForStatus("Running") + # rename computer and join to domain Write-Host "Computer will be renamed to $NewComputerName." Rename-Computer -NewName $NewComputerName -Force -Verbose diff --git a/autounattend.xml b/autounattend.xml index a59e4dd..e03baca 100755 --- a/autounattend.xml +++ b/autounattend.xml @@ -159,7 +159,7 @@ - net use \\ucs.sawtooth.claremontmakerspace.org\software /user:SAWTOOTH\Administrator REPLACE_WITH_PASSWORD + net use \\ucs\software /user:DomainJoin REPLACE_WITH_PASSWORD Set Up UCS Share 1