Functions/Get-MSOnlineSettingObjects.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
<#
.SYNOPSIS This function returns objects representing the various settings which can be retrieved from Microsoft Online. .DESCRIPTION This function returns objects representing the various settings which can be retrieved from Microsoft Online. Each object contains a description of the setting, a script block which returns the value of the setting, and the name of the setting which is suitable for a variable name. #> function Get-MSOnlineSettingObjects { [CmdletBinding(PositionalBinding=$false)] [OutputType([PSCustomObject[]])] param () # Return the setting objects return @( [PSCustomObject]@{ Description = "account SKUs" ScriptBlock = { Get-MsolAccountSku | Sort-Object -Property "SkuPartNumber" } VariableName = "AccountSkus" }, [PSCustomObject]@{ Description = "administrative units" ScriptBlock = { Get-MsolAdministrativeUnit } VariableName = "AdministrativeUnits" }, [PSCustomObject]@{ Description = "administrative unit members" ScriptBlock = { foreach ($unit in (Get-MsolAdministrativeUnit)) { foreach ($member in (Get-MsolAdministrativeUnitMember -AdministrativeUnitObjectId $unit.ObjectId)) { $member | Add-Member -NotePropertyName "AdministrativeUnitDisplayName" -NotePropertyValue $unit.DisplayName $member | Add-Member -NotePropertyName "AdministrativeUnitDisplayObjectID" -NotePropertyValue $unit.ObjectID $member } } } VariableName = "AdministrativeUnitMembers" }, [PSCustomObject]@{ Description = "company allowed data locations" ScriptBlock = { Get-MsolCompanyAllowedDataLocation } VariableName = "CompanyAllowedDataLocations" }, [PSCustomObject]@{ Description = "company information" ScriptBlock = { Get-MsolCompanyInformation } VariableName = "CompanyInformation" }, [PSCustomObject]@{ Description = "device registration service policies" ScriptBlock = { Get-MsolDeviceRegistrationServicePolicy } VariableName = "DeviceRegistrationServicePoliciesCsv" }, [PSCustomObject]@{ Description = "DirSync features" ScriptBlock = { Get-MsolDirSyncFeatures | Sort-Object -Property "DirSyncFeature" } VariableName = "DirSyncFeatures" }, [PSCustomObject]@{ Description = "domains" ScriptBlock = { Get-MsolDomain | Sort-Object -Property "Name" } VariableName = "Domains" }, [PSCustomObject]@{ Description = "domain federation settings" ScriptBlock = { foreach ($domain in (Get-MsolDomain)) { if ($domain.Authentication -eq "Federated") { Get-MsolDomainFederationSettings -DomainName $domain.Name } } } VariableName = "DomainFederationSettings" }, [PSCustomObject]@{ Description = "roles" ScriptBlock = { Get-MsolRole | Sort-Object -Property "Name" } VariableName = "Roles" }, [PSCustomObject]@{ Description = "role members" ScriptBlock = { foreach ($role in (Get-MsolRole)) { foreach ($member in (Get-MsolRoleMember -RoleObjectId $role.ObjectID)) { $member | Add-Member -NotePropertyName "RoleName" $role.Name $member } } } VariableName = "RoleMembers" }, [PSCustomObject]@{ Description = "scoped role members" ScriptBlock = { foreach ($role in (Get-MsolRole)) { foreach ($unit in (Get-MsolAdministrativeUnit)) { foreach ($member in (Get-MsolScopedRoleMember -RoleObjectId $role.ObjectId -AdministrativeUnitObjectId $unit.ObjectID)) { $member | Add-Member -NotePropertyName "ScopedAdministrativeUnitId" -NotePropertyValue $unit.ObjectID $member | Add-Member -NotePropertyName "ScopedAdministrativeUnitDisplayName" -NotePropertyValue $unit.DisplayName $member | Add-Member -NotePropertyName "ScopedRoleName" -NotePropertyValue $role.Name $member } } } } VariableName = "ScopedRoleMembers" }, [PSCustomObject]@{ Description = "service principals" ScriptBlock = { foreach ($principal in (Get-MsolServicePrincipal)) { $tempObject = $principal | Select-Object * $tempObject.Addresses = $tempObject.Addresses.Address $tempObject } } VariableName = "ServicePrincipals" }, [PSCustomObject]@{ Description = "subscriptions" ScriptBlock = { Get-MsolSubscription | Sort-Object -Property "SkuPartNumber" } VariableName = "Subscriptions" } ) } |