active directory - equivalent of gpresult /r with powershell without ad module -


i'm working on powershell script that, after doing stuffs, should launch 1 of 3 applications based on user ad group membership. can't load ad module, i'm using gpresult.exe /r

$temp = gpresult.exe /r if ($temp -match "myadgroup") { ... } 

is there powershell command same thing more efficiently?

one way is:

$currentuser = [system.security.principal.windowsidentity]::getcurrent()  $windowsprincipal = new-object system.security.principal.windowsprincipal($currentuser)  if($windowsprincipal.isinrole("myadgroup")) {   ... } else {    ... } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -