@@ -38,23 +38,18 @@ function Invoke-CIPPStandardTeamsExternalFileSharing {
3838 Write-Host " TeamsExternalFileSharing: $ ( $Settings | ConvertTo-Json ) "
3939 $CurrentState = New-TeamsRequest - TenantFilter $Tenant - Cmdlet ' Get-CsTeamsClientConfiguration' | Select-Object AllowGoogleDrive, AllowShareFile, AllowBox, AllowDropBox, AllowEgnyte
4040
41- if ($null -eq $Settings.AllowGoogleDrive ) { $Settings.AllowGoogleDrive = $false }
42- if ($null -eq $Settings.AllowShareFile ) { $Settings.AllowShareFile = $false }
43- if ($null -eq $Settings.AllowBox ) { $Settings.AllowBox = $false }
44- if ($null -eq $Settings.AllowDropBox ) { $Settings.AllowDropBox = $false }
45- if ($null -eq $Settings.AllowEgnyte ) { $Settings.AllowEgnyte = $false }
46-
47- $StateIsCorrect = ($CurrentState.AllowGoogleDrive -eq $Settings.AllowGoogleDrive ) -and
48- ($CurrentState.AllowShareFile -eq $Settings.AllowShareFile ) -and
49- ($CurrentState.AllowBox -eq $Settings.AllowBox ) -and
50- ($CurrentState.AllowDropBox -eq $Settings.AllowDropBox ) -and
51- ($CurrentState.AllowEgnyte -eq $Settings.AllowEgnyte )
41+ $StateIsCorrect = ($CurrentState.AllowGoogleDrive -eq $Settings.AllowGoogleDrive ?? $false ) -and
42+ ($CurrentState.AllowShareFile -eq $Settings.AllowShareFile ?? $false ) -and
43+ ($CurrentState.AllowBox -eq $Settings.AllowBox ?? $false ) -and
44+ ($CurrentState.AllowDropBox -eq $Settings.AllowDropBox ?? $false ) -and
45+ ($CurrentState.AllowEgnyte -eq $Settings.AllowEgnyte ?? $false )
5246
5347 if ($Settings.remediate -eq $true ) {
5448 if ($StateIsCorrect -eq $true ) {
5549 Write-LogMessage - API ' Standards' - tenant $Tenant - message ' Teams External File Sharing already set.' - sev Info
5650 } else {
5751 $cmdParams = @ {
52+ Identity = ' Global'
5853 AllowGoogleDrive = $Settings.AllowGoogleDrive
5954 AllowShareFile = $Settings.AllowShareFile
6055 AllowBox = $Settings.AllowBox
@@ -84,7 +79,7 @@ function Invoke-CIPPStandardTeamsExternalFileSharing {
8479 if ($Settings.report -eq $true ) {
8580 Add-CIPPBPAField - FieldName ' TeamsExternalFileSharing' - FieldValue $StateIsCorrect - StoreAs bool - Tenant $Tenant
8681
87- if ($StateIsCorrect ) {
82+ if ($StateIsCorrect -eq $true ) {
8883 $FieldValue = $true
8984 } else {
9085 $FieldValue = $CurrentState
0 commit comments