Skip to content

Add SYSTEM membership check for WSS_WPG group#4

Open
Rob3r70 wants to merge 3 commits into
stefangossner:mainfrom
Rob3r70:patch-1
Open

Add SYSTEM membership check for WSS_WPG group#4
Rob3r70 wants to merge 3 commits into
stefangossner:mainfrom
Rob3r70:patch-1

Conversation

@Rob3r70

@Rob3r70 Rob3r70 commented Apr 16, 2026

Copy link
Copy Markdown

Updated script to check for SYSTEM membership in WSS_WPG group and added error handling for group membership check.

Updated script to check for SYSTEM membership in WSS_WPG group and added error handling for group membership check.
Copilot AI review requested due to automatic review settings April 16, 2026 14:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an early safety check to the SharePoint SE CU install helper script to detect whether the SYSTEM account (SID S-1-5-18) is a member of the local WSS_WPG group, and reports errors encountered while querying group membership.

Changes:

  • Added a Get-LocalGroupMember check for SYSTEM membership in WSS_WPG.
  • Added a try/catch around the membership lookup and wrote status/error output accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Install-SPSE_Fix.ps1
Comment on lines +54 to +63
Write-Host "❌ SYSTEM is a member of '$GroupName'" -ForegroundColor Red
break
break
}
else {
Write-Host "✅ SYSTEM (S-1-5-18) is not a member of '$GroupName'" -ForegroundColor Green
}
}
catch {
Write-Host "❌ Error checking group membership: $($_.Exception.Message)" -ForegroundColor Red

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other Write-Host status messages in this script appear to be plain ASCII text; introducing emoji characters here may cause garbled output in some consoles/log pipelines and makes output harder to grep/parse consistently. Consider using a text prefix (e.g., "ERROR:" / "OK:") instead of emojis.

Suggested change
Write-Host " SYSTEM is a member of '$GroupName'" -ForegroundColor Red
break
break
}
else {
Write-Host " SYSTEM (S-1-5-18) is not a member of '$GroupName'" -ForegroundColor Green
}
}
catch {
Write-Host " Error checking group membership: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "ERROR: SYSTEM is a member of '$GroupName'" -ForegroundColor Red
break
break
}
else {
Write-Host "OK: SYSTEM (S-1-5-18) is not a member of '$GroupName'" -ForegroundColor Green
}
}
catch {
Write-Host "ERROR: Error checking group membership: $($_.Exception.Message)" -ForegroundColor Red

Copilot uses AI. Check for mistakes.
Comment thread Install-SPSE_Fix.ps1 Outdated
Comment on lines +55 to +56
break
break

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break is used here at script scope (not inside a loop/switch), which will throw "Cannot break outside of a loop" and prevent the script from running correctly. Use Exit (optionally with a non-zero code) or throw/return to stop execution instead, depending on desired behavior.

Suggested change
break
break
Exit 1

Copilot uses AI. Check for mistakes.
Comment thread Install-SPSE_Fix.ps1 Outdated
Comment thread Install-SPSE_Fix.ps1
Rob3r70 and others added 2 commits April 16, 2026 16:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants