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:UsersAdministrator> 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:UsersAdministrator> Prepare-PlacesEnablement
WriteError: C:UsersAdministratorDocumentsPowerShellScriptsPrepare-PlacesEnablement.ps1:52
Line |
52 | [bool]$PlacesMobileApp = $false,
| ~~~~~~~
| Cannot overwrite variable false because it is read-only or constant.
PS C:UsersAdministrator>
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
From the instructions on https://learn.microsoft.com/en-us/deployoffice/places/deployment-guide-for-placesPS C:UsersAdministrator> Install-Script -Name Prepare-PlacesEnablement -RequiredVersion 1.0Untrusted repositoryYou 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 youwant to install the scripts from ‘PSGallery’?[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “N”): aPS C:UsersAdministrator> Prepare-PlacesEnablementWriteError: C:UsersAdministratorDocumentsPowerShellScriptsPrepare-PlacesEnablement.ps1:52Line |52 | [bool]$PlacesMobileApp = $false,| ~~~~~~~| Cannot overwrite variable false because it is read-only or constant.PS C:UsersAdministrator>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 Read More