[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 522
  • Last Modified:

Logon Script base on vbscript

Hello,
I am new in vb script.
I have a Terminal Servers farm and pc stations which logon to a windows 2003 Domain.
I like to check group membership and map drives to home directories.
I try to run a script which map only the members of "ts2003" to home directory.
I get the Error: Type Mismatch: 'isMember' code: 800A000D.

the script is..

'on error resume next
Dim WshNetwork, strUserName
Set WshNetwork = CreateObject("Wscript.Network")
strUserName = WshNetwork.UserName
if isMember(WshNetwork.username, "ts2003") Then
WshNetwork.MapNetworkDrive "m:","\\Server1\Users\" & strUserName
End if
Wscript.quit


Thank you.
A.B
0
abendv_10
Asked:
abendv_10
1 Solution
 
Julian HansenCommented:
Try this

set group = GetObject("WinNT://Domain/GroupName")

userpath = "WinNT://Domain/" & strUserName

if group.IsMember ( userpath ) then
    WshNetwork.MapNetworkDrive "m:","\\Server1\Users\" & strUserName
end if

wscript.quit

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now