Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell - Compiling with Modules

I have created a log-on script based on Active-Directory Module, that queries the user group membership in order to map his drives etc.

I have compiled it with PowerGui, and created an EXE file. the problem is, the module doesn't exist on the users computers.

Is there a way to do this without the module, or add the module to the compilation?

like image 680
Benny Avatar asked Oct 22 '22 11:10

Benny


1 Answers

For group memberships, you could also get it without connecting to AD, and parse the output of the WHOAMI utility

$groups = WHOAMI /GROUPS /FO CSV | ConvertFrom-Csv | Select-Object -ExpandProperty 'Group Name'

if($groups -contains 'group1')
{
   do something
}
like image 158
Shay Levy Avatar answered Oct 24 '22 03:10

Shay Levy