-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateTheme.ps1
25 lines (17 loc) · 1 KB
/
UpdateTheme.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
#2019 Azure Devops Server (On Prem) Script For Updating Theme
#Online you set this setting at an org level. On prem treats each client as a org of its own
#This will jump through all your collections and set the theme. I had to harvest these commands from the GUI's network trafic
#Base URL
$tfsUri = "https://XXXX.com"
#Value to
$json = ConvertTo-Json @{
"WebPlatform/Theme" = "ms.vss-web.vsts-theme-dark"
}
#Get all the TFS collections to jump through them
$GetCollectionsCall = $tfsUri + '/_apis/projectCollections?api-version=1.0'
$tfsCollections = Invoke-RestMethod -Method Get -ContentType application/json -Uri $GetCollectionsCall -UseDefaultCredentials
#Update each collection to have the new theme
foreach($tfsCollection in $tfsCollections.value){
$UpdateThemeCall = "$tfsUri/" + $tfsCollection.name + '/_apis/Settings/Entries/globalme?api-version=4.1-preview.1'
Invoke-RestMethod -Uri $UpdateThemeCall -Method patch -Body $json -ContentType application/json -UseDefaultCredentials
}