Skip to content

Commit 847ff20

Browse files
authored
Merge pull request #98 from TheJumpCloud/SA-3527-Leave-domain-Ad-Status-Bug
SA-3527 fix ad status for leave domain
2 parents 025039c + 8c6b71c commit 847ff20

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

jumpcloud-ADMU/Powershell/Start-Migration.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,13 @@ Function Start-Migration {
19771977
New-Item -ItemType Directory -Force -Path $path
19781978
}
19791979
$appxList = @()
1980+
# Get Azure AD Status
1981+
$ADStatus = dsregcmd.exe /status
1982+
foreach ($line in $ADStatus) {
1983+
if ($line -match "AzureADJoined : ") {
1984+
$AzureADStatus = ($line.trimstart('AzureADJoined : '))
1985+
}
1986+
}
19801987
if ($AzureADProfile -eq $true -or $netBiosName -match 'AzureAD') {
19811988
# Find Appx User Apps by Username
19821989
try {
@@ -2042,12 +2049,6 @@ Function Start-Migration {
20422049
#region Leave Domain or AzureAD
20432050

20442051
if ($LeaveDomain -eq $true) {
2045-
# Get Azure AD Status
2046-
foreach ($line in $AzureADInfo) {
2047-
if ($line -match "AzureADJoined : ") {
2048-
$AzureADStatus = ($line.trimstart('AzureADJoined : '))
2049-
}
2050-
}
20512052
if ($AzureADStatus -match 'YES') {
20522053
# Check if user is not NTAUTHORITY\SYSTEM
20532054
if (([bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).user.Value -match "S-1-5-18")) -eq $false) {

0 commit comments

Comments
 (0)