mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 13:27:41 +02:00
Updated the manuals
This commit is contained in:
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-admin.ps1
|
||||
✅ Yes
|
||||
✅ Yes, Markus has admin rights.
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script checks if the user has administrator rights.
|
||||
.EXAMPLE
|
||||
PS> ./check-admin.ps1
|
||||
✅ Yes
|
||||
✅ Yes, Markus has admin rights.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -53,18 +53,18 @@ try {
|
||||
$user = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = (New-Object Security.Principal.WindowsPrincipal $user)
|
||||
if ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
|
||||
"✅ Yes"
|
||||
"✅ Yes, $USERNAME has admin rights."
|
||||
} elseif ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Guest)) {
|
||||
"⚠️ No, guest rights only"
|
||||
"⚠️ No, $USERNAME, has guest rights only."
|
||||
} else {
|
||||
"⚠️ No, normal user rights only"
|
||||
"⚠️ No, $USERNAME has normal user rights only."
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
"⚠️ Error: $($Error[0]) (in script line $($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 05/19/2024 10:25:17)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 08/15/2024 09:50:45)*
|
||||
|
Reference in New Issue
Block a user