JoinDomain check
This commit is contained in:
@@ -10,6 +10,13 @@ Start-Transcript -Path "$MDTPath\_Logs\$CompName-JoinDomain.log" -Append
|
||||
$CompType = $args[0]
|
||||
$SubType = $args[1]
|
||||
|
||||
# Check if we're already in the domain
|
||||
if ((gwmi win32_computersystem).partofdomain -eq $true) {
|
||||
write-host -ForegroundColor Green "Already in the domain! Exiting."
|
||||
Stop-Transcript
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($CompType -like "WKS") {
|
||||
New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\LSA" -Name NetJoinLegacyAccountReuse -Value 1
|
||||
$PCNamePrefix = ($CompName.Substring(0,$CompName.IndexOf("-")))
|
||||
|
Reference in New Issue
Block a user