Forum Discussion
Prepare-PlacesEnablement script fails with "Cannot overwrite variable false because it is read-only"
From the instructions on
https://learn.microsoft.com/en-us/deployoffice/places/deployment-guide-for-places
PS C:\Users\Administrator> Install-Script -Name Prepare-PlacesEnablement -RequiredVersion 1.0
Untrusted repository
You are installing the scripts from an untrusted repository. If you trust this repository,
change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you
want to install the scripts from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): a
PS C:\Users\Administrator> Prepare-PlacesEnablement
WriteError: C:\Users\Administrator\Documents\PowerShell\Scripts\Prepare-PlacesEnablement.ps1:52
Line |
52 | [bool]$PlacesMobileApp = $false,
| ~~~~~~~
| Cannot overwrite variable false because it is read-only or constant.
PS C:\Users\Administrator>
Script contents:
<#PSScriptInfo
.VERSION 1.0
.GUID 4426682f-fed2-47fe-9a75-7d61f1764139
.AUTHOR jayam
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
<#
.DESCRIPTION
This script enables the groups created by the PreparePlacesGroups script with their corresponding Places features
#>
Param()
param (
[Alias("Places Web", "Places Web App")]
[bool]$PlacesWebApp = $true,
[Alias("Places Advanced Features", "PlacesPremium")]
[bool]$PlacesAdvancedFeatures = $false,
[Alias("Places Mobile", "PlacesMobile")]
[bool]$PlacesMobileApp = $false,
[Alias("Places Analytics Users", "AnalyticsUsers")]
[bool]$PlacesAnalytics = $false
)
$modules = Get-Module
$placesInstalled = $false
Environment is Server 2022
PowerShell 7.4.3
Exchange Tentant is a couple of years old.
- Hey all, we have posted updated scripts that should resolve this issue. Please check the latest instructions and commands here: https://learn.microsoft.com/en-us/deployoffice/places/deployment-guide-for-places
- jv83642Copper Contributor
I encountered the same issue this morning when attempting to run this script. Does the script need to be updated, or is something in our environment needing attention? Thanks!
Please do the following:
-
Check Variable Names: Ensure that the variable you are trying to modify is correctly named and not a reserved keyword or system variable.
-
Scope of Variables: Verify the scope of the variable. If it is defined outside the current script, make sure it is accessible within the script.
-
Variable Assignment: Double-check the line where the variable is assigned. Ensure that there are no typos or syntax errors.
-
Script Dependencies: Review any dependencies or prerequisites for the Prepare-PlacesEnablement script. Make sure all required modules or functions are available.
-
Repository Trust: If you are installing scripts from an untrusted repository, consider changing the InstallationPolicy value using the Set-PSRepository cmdlet.
- timhoffmannBrass ContributorThis is a Microsoft supplied script, there is nothing for me to check.
- jv83642Copper ContributorI tried the same script later on with no modifications and it worked. Not sure what changed?
-
- BrettGiammonaMicrosoftHey all, we have posted updated scripts that should resolve this issue. Please check the latest instructions and commands here: https://learn.microsoft.com/en-us/deployoffice/places/deployment-guide-for-places
- baczerCopper Contributor
- Stephanie NicholsBrass ContributorConfirming that I'm also still getting the error message with the new scripts.
- tjhdev2024Copper Contributor
BrettGiammona Version 4 does not produce a PowerShell error message, and defaults all params to False. A single parameter set to true is processed as expected.
PS C:\Users\Administrator> Prepare-PlacesEnablement $ PS C:\Users\Administrator> Prepare-PlacesEnablement -placesmobileapp $true $ Enabling the group that can use the Places iOS App Looking for group - Places Mobile Users [8C8BF34B-6BB8-4441-A911-3A990C9D838B] Update completed successfully. To check the information updated please use the next cmdlet which reads updated values of settings from store. Get-PlacesSettings -ReadFromPrimary WARNING: The settings are read from a cached storage for upto 12 hours.
- BrettGiammonaMicrosoftThat looks right. You can override the default params to True for any features you wish to turn on.
- mparc1260Copper Contributor
The new script still doesn't work, same error
...Prepare-PlacesEnablement.ps1 -PlacesWebApp $true -PlacesAdvancedFeatures $true -PlacesAnalytics $true -PlacesMobileApp $true
WriteError: C:\Users\mparc\Documents\PowerShell\Scripts\Prepare-PlacesEnablement.ps1:52
Line |
52 | [bool]$PlacesMobileApp = $false,
| ~~~~~~~
| Cannot overwrite variable false because it is read-only or constant.
- gbartumeuBrass Contributor
Any news about this error?
I installed v4 and still have the same problem (also I tested v5).
- mparc1260Copper Contributor
Scripts are working ok, the key is to remove what has been already created previously, delete all Places groups from the Entra then start from the scratch with the newest scripts. Elo!
- timhoffmannBrass ContributorYou probably need to "update-script" (or upgrade-script I forget which) rather than install. Install I think will see you already have it and not change anything.
- VishalK95Copper Contributor
tjhdev2024 I am getting the same issue when attempting to use the enable script. I Have used both version 4 and 5 and error still appears.
How long did you wait for the retry for it to work for you.
- timhoffmannBrass ContributorI deleted the existing script and installed whatever it thought was the latest that day.
```
PS C:\Users\Administrator\Documents\PowerShell\Scripts> dir
Directory: C:\Users\Administrator\Documents\PowerShell\Scripts
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 6/25/2024 4:40 PM InstalledScriptInfos
-a--- 6/29/2024 12:49 AM 6148 Prepare-PlacesEnablement.ps1
-a--- 6/11/2024 8:48 PM 3558 PreparePlacesGroups.ps1
-a--- 6/11/2024 11:14 PM 1010 PreparePlacesPowershell7.ps1
PS C:\Users\Administrator\Documents\PowerShell\Scripts>
```- VishalK95Copper ContributorBasically realised they released a series of new scripts and started all from scratch and even removed the old groups created. Downloaded a fresh set of scripts and removed all Modules from Powershell V7 that were downloaded as part of the process.
Now on the enablement side and get the error:
WriteError: C:\Program Files\WindowsPowerShell\Scripts\Prepare-PlacesEnablement.ps1:52
Line |
52 | [bool]$PlacesMobileApp = $false,
| ~~~~~~~
| Cannot overwrite variable false because it is read-only or constant.
So I got the new scripts and still an issue any help be greatly appreciated thanks