Bonjour,

J'ai le script ci-dessous qui se lance à l'ouverture de session par GPO sur un serveur RDS 2012.

Le problème est qu'il ne lance pas tous les lecteurs qu'il devrait alors qu'il n'y a pas d'erreur dans mon script.

De plus d'une ouverture de session à l'autre il monte certains lecteurs et pas d'autres.

Le disque T: ne monte jamais alors que les personnes y ont droit.

J'ai commenté le démontage des disque avant mappage car j'avais vu sur un forum que ça pouvait être l'origine du problème. Mais ça n'a rien résolu.

Avez-vous une piste sur ce comportement que je ne comprends pas ?

Anciennement ce script était en KIXTART, je l'ai traduit en VBS mais ça ne fonctionne pas !

Merci pour vos remarques.



Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
' ********************************************************************
' Script to MAP users disks for ALL CHACAL iX ENVIRONMENTS and merge 
' putty registry and rsa_key at logon
' ********************************************************************
Option Explicit
Dim domainName,userName,ADSPath,grouplistD,GrpName,groupName
Dim objUser,objGroup,WshNetwork,wshShell,strComputerName  
 
' *****************************************************
' GET %USERNAME% to initialize username variable
' *****************************************************
Set WshNetwork = WScript.CreateObject("WScript.Network") 
Set wshShell = CreateObject("WScript.Shell")
 
'WScript.Echo "Computer Name: " & strComputerName
 
GrpName= Array("GRPINFO","GRPCOMDPC","GRPGSBEXPORT","GRPGXF","GRPSUPCHAIN","GRPACHATS","GRPGESTION")
domainName = "mydomain.com"
userName = WshNetwork.UserName
strComputerName = WshNetwork.ComputerName
 
Select Case strComputerName
	Case "V2K12RDS14"  	'DEV
		WSHShell.Run "cmd /c \\DC01\NETLOGON\PuttyDEV.cmd"
	Case "V2K12RDS11"	'PRD
		WSHShell.Run "cmd /c \\DC01\NETLOGON\PuttyDIAPPROD.cmd"
	Case "V2K12RDS12"	'PRD
		WSHShell.Run "cmd /c \\DC01\NETLOGON\PuttyDIAPPROD.cmd"
	Case "V2K12RDS13"	'PRD
		WSHShell.Run "cmd /c \\DC01\NETLOGON\PuttyDIAPPROD.cmd"
	Case "V2K12RDS8"	'REC	
		WSHShell.Run "cmd /c \\DC01\NETLOGON\PuttyDIAP5.cmd"
	Case "V2K12RDS15"	'REC-TMP
		WSHShell.Run "cmd /c \\DC01\NETLOGON\PuttyDIAP7.cmd"
	Case Else
End Select
 
' WSHShell.Run " net Use Q: /Delete"
Wshshell.run "net use Q: \\V2K12NAS\Chacal_Data$"
 
' WSHShell.Run "net Use V: /Delete"
Wshshell.run "net use V: \\VLNXDIAP1\CHACAL_PDF"
 
For each groupName in GrpName
             If IsMember(domainName,userName,groupName) Then
				' WSHShell.Run "net Use U: /Delete"
				wshshell.run "net use U: \\NASGFX\USERS"
			Else
			End If
Next
 
If IsMember(domainName,userName,"GRPPARIS") Then
				' WSHShell.Run "net Use U: /Delete"
				wshshell.run "net use U: \\G2K16PAR01\USERS"
Else
End If				
 
If IsMember(domainName,userName,"GRPPRODDPC") Then
				' WSHShell.Run "net Use U: /Delete"
				wshshell.run "net use U: \\V2K12MTL01\USERS"
Else
End If
 
If IsMember(domainName,userName,"GRP_ESPACE_COMMERCIAL_CHANTIER") Then
				' WSHShell.Run "net Use T: /Delete"
				wshshell.run "net use T: \\NASGFX\AgencesDPCSav"
Else
End If
 
 
WScript.quit
 
' ***********************************************************************
'This function checks if the given AD user is member of the given group.
' ***********************************************************************
 
Function IsMember(domainName,userName,groupName)
   Set groupListD = CreateObject("Scripting.Dictionary")
   groupListD.CompareMode = 1
   ADSPath = domainName & "/" & userName
   Set objUser = GetObject("WinNT://" & ADSPath & ",user")
   For Each objGroup in objUser.Groups
      groupListD.Add objGroup.Name, "-"
   Next
   IsMember = CBool(groupListD.Exists(groupName))
 End Function