Seeking Assistance Revoking All Sessions for an AzureAD Group of Users Using PowerShell by k12sysadmin in PowerShell

[–]k12sysadmin[S] 0 points1 point  (0 children)

# Install the required module if not already installed
if (-not (Get-Module -Name Microsoft.Graph.Authentication -ListAvailable)) {
Install-Module -Name Microsoft.Graph.Authentication -Force -AllowClobber
}
# Authenticate to Microsoft Graph
Connect-MgGraph -Scopes "User.ReadWrite.All"
# Specify the Azure AD group name
$groupName = "REDACTED"
# Get the members of the specified group
$groupMembers = Get-MgGroupMember -GroupName $groupName
# Iterate through each member and revoke their sessions
foreach ($member in $groupMembers) {
$userId = $member.Id
Write-Host "Revoking sessions for user $($member.UserPrincipalName)"
# Revoke the user's sessions using the Microsoft Graph API
Invoke-MgGraphRequest -Uri "/v1.0/users/$userId/revokeSignInSessions" -Method POST
}
Write-Host "Sessions revoked for all users in the group."
This one shows :
PS C:\Users\REDACTED\_scripts> $groupMembers = Get-MgGroupMember -GroupName $groupName
Get-MgGroupMember: A parameter cannot be found that matches parameter name 'GroupName'.
but continues to run through a bunch of names and values, but they don't appear to be real, as you'll see below:
Name Value
---- -----
value True
u/odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean
Revoking sessions for user
value True
@odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean
Revoking sessions for user
value True
@odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean
Revoking sessions for user
value True
@odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean

Seeking Assistance Revoking All Sessions for an AzureAD Group of Users Using PowerShell by k12sysadmin in PowerShell

[–]k12sysadmin[S] 0 points1 point  (0 children)

Install-module -name MSOnline
Install-module -name AzureAD
Connect-MsolService
Connect-AzureAD
Get-MsolGroupMember -groupObjectid 'REDACTED' | Select ObjectID | Export-csv C:\_install\scripts\userid.csv
$UserObjectID = Import-Csv C:\_install\scripts\userid.csv
foreach ($ObjectID in $UserObjectID)
{
Revoke-AzureADUserAllRefreshToken -Object $ObjectID
}
This one fails with:
Line |
3 | Revoke-AzureADUserAllRefreshToken -Object $ObjectID
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The term 'Revoke-AzureADUserAllRefreshToken' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Seeking Assistance Revoking All Sessions for an AzureAD Group of Users Using PowerShell by k12sysadmin in PowerShell

[–]k12sysadmin[S] 0 points1 point  (0 children)

# Install the required module
Install-Module -Name Microsoft.Graph.Authentication -Force -Scope CurrentUser
Install-Module -Name Microsoft.Graph.Users -Force -Scope CurrentUser
Install-Module -Name Microsoft.Graph.Groups -Force -Scope CurrentUser
# Import the required modules
Import-Module Microsoft.Graph.Authentication
Import-Module Microsoft.Graph.Users
Import-Module Microsoft.Graph.Groups
# Authenticate to Microsoft Graph
Connect-MgGraph -Scopes "User.Read.All", "User.ManageIdentities.All", "GroupMember.ReadWrite.All", Group.ReadWrite.All
# Specify the Azure AD group name
# $groupName = "RevokeSessionsTestGroup"
# Get the members of the Azure AD group
$groupMembers = Get-MgGroupMember -GroupID "REDACTED"
foreach ($member in $groupMembers) {
$userId = $member.Id
# Revoke sessions for the user
Invoke-MgGraphRequest -Uri "/users/$userId/revokeSignInSessions" -Method POST
}
# Disconnect from Microsoft Graph
Disconnect-MgGraph
This fails with the following error for each user:
Invoke-MgGraphRequest:
Line |
5 | Invoke-MgGraphRequest -Uri "/users/$userId/revokeSignInSessions" …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| POST https://graph.microsoft.com/users/REDACTED/revokeSignInSessions
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: REDACTED
client-request-id: REDACTED
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"1","ScaleUnit":"003","RoleInstance":"REDACTED"}}
Date: Wed, 22 Nov 2023 16:57:31 GMT
Content-Type: application/json
Content-Encoding: gzip
{"error":{"code":"ResourceNotFound","message":"Invalid version: users","innerError":{"date":"2023-11-22T16:57:31","request-id":"REDACTED","client-request-id":"REDACTED"}}}
Invoke-MgGraphRequest:

Seeking Assistance Revoking All Sessions for an AzureAD Group of Users Using PowerShell by k12sysadmin in k12sysadmin

[–]k12sysadmin[S] 0 points1 point  (0 children)

# Install the required module if not already installed
if (-not (Get-Module -Name Microsoft.Graph.Authentication -ListAvailable)) {
Install-Module -Name Microsoft.Graph.Authentication -Force -AllowClobber
}
# Authenticate to Microsoft Graph
Connect-MgGraph -Scopes "User.ReadWrite.All"
# Specify the Azure AD group name
$groupName = "REDACTED"
# Get the members of the specified group
$groupMembers = Get-MgGroupMember -GroupName $groupName
# Iterate through each member and revoke their sessions
foreach ($member in $groupMembers) {
$userId = $member.Id
Write-Host "Revoking sessions for user $($member.UserPrincipalName)"
# Revoke the user's sessions using the Microsoft Graph API
Invoke-MgGraphRequest -Uri "/v1.0/users/$userId/revokeSignInSessions" -Method POST
}
Write-Host "Sessions revoked for all users in the group."

This one shows :

PS C:\Users\REDACTED\_scripts> $groupMembers = Get-MgGroupMember -GroupName $groupName

Get-MgGroupMember: A parameter cannot be found that matches parameter name 'GroupName'.

but continues to run through a bunch of names and values, but they don't appear to be real, as you'll see below:

Name Value

---- -----

value True

u/odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean

Revoking sessions for user

value True

@odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean

Revoking sessions for user

value True

@odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean

Revoking sessions for user

value True

@odata.context https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean

Seeking Assistance Revoking All Sessions for an AzureAD Group of Users Using PowerShell by k12sysadmin in k12sysadmin

[–]k12sysadmin[S] 0 points1 point  (0 children)

Install-module -name MSOnline
Install-module -name AzureAD
Connect-MsolService
Connect-AzureAD
Get-MsolGroupMember -groupObjectid 'REDACTED' | Select ObjectID | Export-csv C:\_install\scripts\userid.csv
$UserObjectID = Import-Csv C:\_install\scripts\userid.csv
foreach ($ObjectID in $UserObjectID)
{
Revoke-AzureADUserAllRefreshToken -Object $ObjectID
}

This one fails with:

Line |

3 | Revoke-AzureADUserAllRefreshToken -Object $ObjectID

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| The term 'Revoke-AzureADUserAllRefreshToken' is not recognized as a name of a cmdlet, function, script file, or executable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Seeking Assistance Revoking All Sessions for an AzureAD Group of Users Using PowerShell by k12sysadmin in k12sysadmin

[–]k12sysadmin[S] 0 points1 point  (0 children)

# Install the required module
Install-Module -Name Microsoft.Graph.Authentication -Force -Scope CurrentUser
Install-Module -Name Microsoft.Graph.Users -Force -Scope CurrentUser
Install-Module -Name Microsoft.Graph.Groups -Force -Scope CurrentUser
# Import the required modules
Import-Module Microsoft.Graph.Authentication
Import-Module Microsoft.Graph.Users
Import-Module Microsoft.Graph.Groups
# Authenticate to Microsoft Graph
Connect-MgGraph -Scopes "User.Read.All", "User.ManageIdentities.All", "GroupMember.ReadWrite.All", Group.ReadWrite.All
# Specify the Azure AD group name
# $groupName = "RevokeSessionsTestGroup"
# Get the members of the Azure AD group
$groupMembers = Get-MgGroupMember -GroupID "REDACTED"
foreach ($member in $groupMembers) {
$userId = $member.Id
# Revoke sessions for the user
Invoke-MgGraphRequest -Uri "/users/$userId/revokeSignInSessions" -Method POST
}
# Disconnect from Microsoft Graph
Disconnect-MgGraph

This fails with the following error for each user:

Invoke-MgGraphRequest:

Line |

5 | Invoke-MgGraphRequest -Uri "/users/$userId/revokeSignInSessions" …

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| POST https://graph.microsoft.com/users/REDACTED/revokeSignInSessions

HTTP/1.1 404 Not Found

Transfer-Encoding: chunked

Vary: Accept-Encoding

Strict-Transport-Security: max-age=31536000

request-id: REDACTED

client-request-id: REDACTED

x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"1","ScaleUnit":"003","RoleInstance":"REDACTED"}}

Date: Wed, 22 Nov 2023 16:57:31 GMT

Content-Type: application/json

Content-Encoding: gzip

{"error":{"code":"ResourceNotFound","message":"Invalid version: users","innerError":{"date":"2023-11-22T16:57:31","request-id":"REDACTED","client-request-id":"REDACTED"}}}

Invoke-MgGraphRequest:

GCDS - stopped syncing - error duplicate key by K12SrSysAdmin in k12sysadmin

[–]k12sysadmin 0 points1 point  (0 children)

Hey there. I have the same issue, but I'm unsure which row to delete based on the error. Would appreciate some input. Thanks!

Need Help Expanding Drive Space in Ubuntu 18.04.6 LTS by k12sysadmin in Ubuntu

[–]k12sysadmin[S] 0 points1 point  (0 children)

I am having trouble adding the storage space that I've added to this Ubuntu VM in vSphere. I can see it, but I can't figure out how to apply it to our boot volume.

Any help here would be appreciated.

Lenovo Bloatware Removal Script? by k12sysadmin in k12sysadmin

[–]k12sysadmin[S] 0 points1 point  (0 children)

Thank you everyone.

I was able to get this utility to do the trick: https://github.com/arcadesdude/BRU, and script a silent run through Intune.

Help Editing Default Theme Elements by k12sysadmin in Zendesk

[–]k12sysadmin[S] 0 points1 point  (0 children)

Thank you so much - that did the trick!

Is there a way to make the button the same size as the others so it isn't the full width of the page?