Live on Wire:
Graeme Bray

@pcgeek86 Is automating them out of a job via #powershell a bad idea?

Featured Content

Here you always find a fun code snippet that gets you immediate results. Use it as-is, or dive deeper and learn more about it. Featured Content will change regularly. Take a look at the Articles menu to view other topics and articles, or simply enter one or more search terms into out search bar to browse our archives.


function Test-Admin
  $wid = [System.Security.Principal.WindowsIdentity]::GetCurrent()
  $prp = New-Object System.Security.Principal.WindowsPrincipal($wid)
  $adm = [System.Security.Principal.WindowsBuiltInRole]::Administrator

  Tests whether you currently have Admin privileges or not

Learn more

Latest Questions

Can you help out? Or would you like to ask a question yourself? To view answers, click the question headline. And to ask new questions, visit our Q&A section!

Votes Views Answers Question
asked 1 month ago by Matthias
asked 7 months ago by Andreas
asked 8 months ago by Dan Holme
  Ask your own questions and get great answers

Now Online

There are no users currently online

Recommended Reading

  • Killer Feature in PSv4: Desired State Configuration

    Most of the things found in PowerShell 4.0 is consolidation work, but there is one feature called Desired State Configuration (DSC) that really has the potential to become a killer feature. Desired St...

  • Deleting Registry Key Default Value

    Since PowerShell 1.0, there has been a bug in Remove-ItemProperty that prevented you from deleting a registry keys’ default value. This bug still exists in PowerShell 3.0.So if you must get rid of a d...

  • Displaying Message Box

    Here’s some very simple and straight-forward code to display a custom MsgBox in PowerShell.You can specify message text, header, default buttons, and icon to display. Your code can then respond to the...

  • “Spaces” resolve to current path

    When you use Test-Path to check whether a file or folder exists, be aware that spaces resolve to the current path. So this line always returns true: Test-Path ' ' In fact, it points to the curren...

  • Test Administrator Privileges

    Provides a function that will tell you whether or not full Administrative privileges are enabled. The function does not rely on group memberships. Instead, it checks the effective privileges in your access token, so it works with User Account Control.

  • Correctly Showing Balloon Tips

    There are multiple samples on how to show balloon tips. But often, they produce multiple taskbar tray icons or ghost images. So learn how to correctly display toolbar balloon tip windows, and how to get rid of them once you are done.

  • PowerShell Tips Monthly #2: All About Arrays

    The free PowerShell tips Monthly #2 is out! This edition deals with arrays and hashtables and is a very useful cheat sheet whenever you need to work with arrays. Grab it now!

  • Override Execution Policy

    Execution policy controls whether you can run PowerShell scripts or not. It is not a mechanism to prevent evil hackers from running scripts. Instead, it is just a safety belt for your own security so ...