Skip to content

Commit 4d4375b

Browse files
committed
changed the default reason again
1 parent 7580f56 commit 4d4375b

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

Graph.EasyPIM/Graph.EasyPIM.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'Graph.EasyPIM.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.0.13'
15+
ModuleVersion = '0.0.14'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -118,7 +118,7 @@
118118
# IconUri = ''
119119

120120
# ReleaseNotes of this module
121-
ReleaseNotes = 'Changed the default justification. No other changes.'
121+
ReleaseNotes = 'Changed the default justification again. No other changes.'
122122

123123
# Prerelease string of this module
124124
# Prerelease = ''

Graph.EasyPIM/Graph.EasyPIM.psm1

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ function Enable-PIMRole {
6161
.DESCRIPTION
6262
Enable Entra ID PIM roles via an easy to use TUI (Text User Interface). Only supports enabling; not disabling. Use Disable-PIMRole to disable.
6363
64-
If a role needs a reason/ justification you can either enter one, or press enter to go with a default "need for work", or type something and end with * to use it for all the activations.
64+
If a role needs a reason/ justification you can either enter one, or press enter to go with a default, or type something and end with * to use it for all the activations.
6565
6666
.PARAMETER SkipJustification
67-
Optional. If specified, it sets the reason/ justifaction for activation to be a default "need for work".
67+
Optional. If specified, it sets the reason/ justifaction for activation to be a default.
6868
6969
.PARAMETER Justification
7070
Optional. If specified, it sets the reason/ justifaction for activation to whatever is input.
@@ -270,7 +270,23 @@ function Enable-PIMRole {
270270

271271
# Random 12 lower case characters
272272
# $defaultJustification = -join ((97..122) | Get-Random -Count 12 | ForEach-Object {[char]$_})
273-
$defaultJustification = "need for work"
273+
$defaultJustification = "Activated using Graph.EasyPIM"
274+
275+
if ($env:USERDOMAIN) {
276+
$userDomain = "$($env:USERDOMAIN)\"
277+
}
278+
279+
if ($env:USER) {
280+
$defaultJustification = $defaultJustification + " by ${userDomain}$($env:USER)"
281+
} elseif ($env:LOGNAME) {
282+
$defaultJustification = $defaultJustification + " by ${userDomain}$($env:LOGNAME)"
283+
} elseif ($env:USERNAME) {
284+
$defaultJustification = $defaultJustification + " by ${userDomain}$($env:USERNAME)"
285+
}
286+
287+
if ($env:ComputerName) {
288+
$defaultJustification = $defaultJustification + " on $($env:ComputerName)"
289+
}
274290

275291
# I use these for showing progress
276292
[int]$counter = 0
@@ -1019,10 +1035,10 @@ function Enable-PIMGroup {
10191035
.DESCRIPTION
10201036
Enable Entra ID PIM groups via an easy to use TUI (Text User Interface). Only supports enabling; not disabling. Use Disable-PIMGroup to disable.
10211037
1022-
If a group needs a reason/ justification you can either enter one, or press enter to go with a default "need for work", or type something and end with * to use it for all the activations.
1038+
If a group needs a reason/ justification you can either enter one, or press enter to go with a default, or type something and end with * to use it for all the activations.
10231039
10241040
.PARAMETER SkipJustification
1025-
Optional. If specified, it sets the reason/ justifaction for activation to be a default "need for work".
1041+
Optional. If specified, it sets the reason/ justifaction for activation to be a default.
10261042
10271043
.PARAMETER Justification
10281044
Optional. If specified, it sets the reason/ justifaction for activation to whatever is input.
@@ -1207,7 +1223,23 @@ function Enable-PIMGroup {
12071223

12081224
# Random 12 lower case characters
12091225
# $defaultJustification = -join ((97..122) | Get-Random -Count 12 | ForEach-Object {[char]$_})
1210-
$defaultJustification = "need for work"
1226+
$defaultJustification = "Activated using Graph.EasyPIM"
1227+
1228+
if ($env:USERDOMAIN) {
1229+
$userDomain = "$($env:USERDOMAIN)\"
1230+
}
1231+
1232+
if ($env:USER) {
1233+
$defaultJustification = $defaultJustification + " by ${userDomain}$($env:USER)"
1234+
} elseif ($env:LOGNAME) {
1235+
$defaultJustification = $defaultJustification + " by ${userDomain}$($env:LOGNAME)"
1236+
} elseif ($env:USERNAME) {
1237+
$defaultJustification = $defaultJustification + " by ${userDomain}$($env:USERNAME)"
1238+
}
1239+
1240+
if ($env:ComputerName) {
1241+
$defaultJustification = $defaultJustification + " on $($env:ComputerName)"
1242+
}
12111243

12121244
# I use these for showing progress
12131245
[int]$counter = 0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Tested on Windows, macOS, and Linux with PowerShell 7.4. It currently has the fo
2121
- Faster than Entra ID portal in my opinion. There is an initial delay as it pulls all the info, but after that it's pretty fast.
2222
- It always activates the role or group for the maximum allowed duration.
2323
- When selecting roles or groups, if the role or group is already active (and it's been active for more than 5 mins) it will deactivate and activate the role or group. Very useful when you can see a role or group activation is going to expire soon!
24-
- You can skip offering a reason, either via the `-SkipJustification` switch or pressing `ENTER` when asked for one. This will set the reason as "need for work".
24+
- You can skip offering a reason, either via the `-SkipJustification` switch or pressing `ENTER` when asked for one. This will set the reason as `Activated using Graph.EasyPIM by $env:USER on $env:COMPUTERNAME`.
2525
- You can provide a justification before hand via the `-Justification` switch, or by entering one when prompted and adding an asterisk `*` at the end. This will set the same justification for all other roles or groups enabled in that round.
2626
- The [Norton Commander](https://en.wikipedia.org/wiki/Norton_Commander)-ish TUI is a nice trip down memory lane. 🙂
2727

0 commit comments

Comments
 (0)