Windows 10 login script to map folder

Hi Guys,
The objective here is to get a Windows 10 computer to map a network folder only if the user belongs to a particular security group using a login script.

I have a .bat file that used to work for Windows 7 computers using the following code:

 ifmember "Security group name" THEN
 NET USE F: /DELETE /YES
 NET USE F: \\SERVERNAME\FOLDERNAME /persistent:yes

But I just try it with a Windows 10 computer and came back with:
'ifmember' is not recognized as an internal of external command

Just in case it makes any difference my domain is Windows Server 2012.

So I guess I'm moving to VBS or PowerShell whatever works.

Can you please give me a login script that works to map a shared folder in a Windows 10 computer?

Thanks in advance.
cargexAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

McKnifeCommented:
ifmember.exe needs to be present on the computer.
It's not part of win7, nor of 10.

So you shuld place it at the server.
\\server\share\ifmember.exe ...

Or use the recommended method which is Group Policy preferences: http://blogs.technet.com/b/askds/archive/2009/01/07/using-group-policy-preferences-to-map-drives-based-on-group-membership.aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rakesh KapoorCommented:
Are you only looking for login script to map the drive or you are also open for item level targeting option to map the drive.
cargexAuthor Commented:
Just mapping the drive.
Thanks to McNife comment pointing out that "ifmember"  is no longer part of the Windows client, I'm currently looking for alternative solutions.

Apparently there are GPOs that do the job now.
Can somebody please point me in the right direction?
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

McKnifeCommented:
"pointing out that "ifmember"  is no longer part of the Windows client" - no, it never was part of windows, your win7 machines work because someone has copied it over to them.
You don't need alternatives but the link I gave you
OR
copy it to 10
OR
use the syntax I gave you which points at a server based ifmember.exe
cargexAuthor Commented:
Mr. McKnife,
During the time in between comments I found out that there are now GPOs that can do the job, and they were apparently created to replace it.

http://blogs.msmvps.com/cgross/2008/12/16/the-death-of-ifmember/

Can you please confirm if indeed the way of the GPO is the future for this?
McKnifeCommented:
Sure, that's the way. Detailed steps: see my link again.
cargexAuthor Commented:
Mr. McKnife,
You are absolutely right.
The recommended method using Group Policy preferences is the right way to do this.

Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.