@@ -63,7 +63,7 @@ I decided to use PowerShell to write this script because it provides easy native
63
63
64
64
### Step 1 – Reading the parameter from the command line.
65
65
66
- ```
66
+ ``` powershell
67
67
Param($XLFile)
68
68
69
69
if ($Null -eq $XLFile)
@@ -78,7 +78,7 @@ if ($Null -eq $XLFile)
78
78
79
79
### Step 2 – Importing data from the 2 sheets of my spreadsheet.
80
80
81
- ```
81
+ ``` powershell
82
82
$tokens =@{}
83
83
$invited=@{}
84
84
@@ -93,7 +93,7 @@ if ($XLFile)
93
93
94
94
### Step 3 – Iterating over the Workspaces sheet to collect client secrets, and retrieve access tokens.
95
95
96
- ```
96
+ ``` powershell
97
97
# Ask for client_Secret of each workspace in Excel file
98
98
foreach ($workspace in $workspaces_excel ) {
99
99
$client_id = $workspace.'Client Id'
@@ -131,7 +131,7 @@ Note that, at the end of this loop, I have a hash table of tokens indexed by Cli
131
131
132
132
### Step 4 – Iterating over Users sheet to invite each of them.
133
133
134
- ```
134
+ ``` powershell
135
135
# Now walk the list of users to add
136
136
$invited.Add($client_id,0)
137
137
foreach ($user in $users_excel ) {
@@ -184,7 +184,7 @@ Note that before the loop, I initialized to zero the count of invited users for
184
184
185
185
### Step 5: Displaying list of users invited in each workspace.
186
186
187
- ```
187
+ ``` powershell
188
188
else
189
189
{
190
190
write-host 'Mailing list file not provided nor found....'
@@ -240,7 +240,7 @@ foreach ($workspace in $workspaces_excel ) {
240
240
241
241
Let’s run this script, making sure to reference the right Excel spreadsheet:
242
242
243
- ```
243
+ ``` powershell
244
244
PS /Volumes/Dev/GreenLake/GLP-API-Tooling/Scripts> ./bulk_invite.ps1 -XLfile userlist.xlsx
245
245
Enter HPE GreenLake Client Secret for Workspace HPEDEV -GLCP- Hackshack: ********************************
246
246
Enter HPE GreenLake Client Secret for Workspace Super Awesome Company: ********************************
0 commit comments