Link to home
Start Free TrialLog in
Avatar of mhamer
mhamer

asked on

Powershell Ifmemeber type command?

Hi im looking to create a powershell script  that checks group membership and does various things based on outcome

ifmember of group 1  then do job1
ifmember of group 1 then do job 2
if member of group 3 then job 3
carry on with script

type if thing, imm sure you get the idea :-)

i can do this with ifmember just looking for powershell equivilant.
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image


What context are you running this in?

PS doesn't have an IfMember equivalent. You can write one, or you can use a number of different methods exposed by the .NET framework. Which is appropriate depends on context.

Chris
Avatar of mhamer
mhamer

ASKER

will be a deployment by sccm

would have like to do one PS script but i guess  three seperate packages would do.

so the PS script will be called by sccm install.cmd
Avatar of mhamer

ASKER

not sure if this helps but..

the package runs as a (svc account )

a seperate package ruiing as a user process will then copy the files to profile path (as administrater)
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mhamer

ASKER

Great thank you will give that a go