Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test if PowerShell is launched as admin #4

Open
itpro-tips opened this issue Mar 5, 2020 · 2 comments
Open

Test if PowerShell is launched as admin #4

itpro-tips opened this issue Mar 5, 2020 · 2 comments

Comments

@itpro-tips
Copy link

@itpro-tips itpro-tips commented Mar 5, 2020

Hi,
ADEssentials is very great but I think it could be useful to verify if PowerShell is launched as admin (prevent running or maybe only alert user if it not).

I guess you already know how to to that but if you need.

Because, for some tests, admin context is needed or we get an unexpected and unreal value (for example with Get-WinADDFSHealth).
Of course, same think is true with Testimo.

@itpro-tips itpro-tips changed the title Test if PoerShell is launched as admin Test if PowerShell is launched as admin Mar 5, 2020
@PrzemyslawKlys

This comment has been minimized.

Copy link
Member

@PrzemyslawKlys PrzemyslawKlys commented Mar 5, 2020

You should be able to run the test as a user that has permissions on DC, but not on your workstation. Also specifically to Testimo, I don't want to prevent that as some tests will work as a standard users. Get-ADUser/Get-ADComputer and many other tests do not require Domain Admin rights, and even if they require Domain Admin they don't require local admin. It's hard to reliably define test to verify for that.

@itpro-tips

This comment has been minimized.

Copy link
Author

@itpro-tips itpro-tips commented Mar 5, 2020

I understand (and agree) with your point of view, but unfortunately 'run as admin' is often required with some CMDlet.
I ran Testimo from DC (never tested from workstation by now) and the CMDlet with issue is Get-CimData -NameSpace "root\microsoftdfs" -Class 'dfsrreplicatedfolderinfo'

I suppose other CMDlet has the same problem, but not very easy to find which one.
To be honest, I don't know how to handle this without effort, but I think I can be useful to mention it in a documentation ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.