Skip to content

Commit

Permalink
pass pester tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardchalstrey1 committed Aug 29, 2023
1 parent c596614 commit d8e42fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions deployment/administration/SHM_Delete_Unassigned_Users.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ $null = Set-AzContext -SubscriptionId $config.subscriptionName -ErrorAction Stop
$script = "remote/Delete_Unassigned_Users.ps1"

# Passing a param to a remote script requires it to be a string
if ($dryRun.IsPresent){
if ($dryRun.IsPresent) {
Add-LogMessage -Level Info "Listing users not assigned to any security group from $($config.dc.vmName)..."
$params = @{dryRun = "yes" }
} else {
Add-LogMessage -Level Info "Deleting users not assigned to any security group from $($config.dc.vmName)..."
$params = @{dryRun = "no"}
$params = @{dryRun = "no" }
}
$result = Invoke-RemoteScript -Shell "PowerShell" -ScriptPath $script -VMName $config.dc.vmName -ResourceGroupName $config.dc.rg -Parameter $params

Expand Down
6 changes: 2 additions & 4 deletions deployment/administration/remote/Delete_Unassigned_Users.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ if ($dryRun -eq "no") {
try {
Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" -ErrorAction Stop
Start-ADSyncSyncCycle -PolicyType Delta
}
catch [System.IO.FileNotFoundException] {
} catch [System.IO.FileNotFoundException] {
Write-Output "Skipping as Azure AD Sync is not installed"
}
catch {
} catch {
Write-Output "Unable to run Azure Active Directory synchronisation!"
}
}

0 comments on commit d8e42fa

Please sign in to comment.