Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2692 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  [RESOLU] [VBS] Probleme script vbs

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[RESOLU] [VBS] Probleme script vbs

n°1841395
nolife75
Posté le 22-01-2009 à 06:40:29  profilanswer
 

Bonjour.
 
Voila mon code voir en dessous pour ce que je veux faire :
 
' Mapping lecteur G
' ---------------------------------------------------------------------'
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUser, strPassword, strProfile
Dim WshNet, computername  
 
Set WshNet = CreateObject("Wscript.Network" )  
computername = WshNet.ComputerName  
 
 
' Values of variables set
strDriveLetter = "G:"
strRemotePath = "\\& Computername\C$\subst"
strUser = "*****"
strPassword = "*****"
strProfile = "false"
Set objNetwork = WScript.CreateObject("WScript.Network" )
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, _
strProfile, strUser, strPassword

 
Je voudrais que le "computername" dans strRemotePath change automatiquement en fonction du nom du PC courrant et monter un lecteur G sur le poste courrant en utilisant le dossier subst créé à la racine du C:
 
Le message d'erreur est le suivant :
 
ligne : 19
Caract. : 1
Erreur : Aucun logiciel réseau n'a accepté le chemin réseau fourni
Code : 800704B3
Source : WSHNetwork.MapNetworkDrive
 
Merci d'avance de corriger mes lignes de codes


Message édité par nolife75 le 22-01-2009 à 13:49:06
mood
Publicité
Posté le 22-01-2009 à 06:40:29  profilanswer
 

n°1841417
olivthill
Posté le 22-01-2009 à 09:30:05  profilanswer
 

Essayer :

strRemotePath = "\\" & Computername & "\C$\subst"

n°1841419
nolife75
Posté le 22-01-2009 à 09:35:42  profilanswer
 

olivthill a écrit :

Essayer :

strRemotePath = "\\" & Computername & "\C$\subst"



 
 
 :D  merci beaucoup ! Ta ligne fonctionne, tu m'as donné un serieux coup de main !

n°1924658
gradek
Posté le 16-09-2009 à 22:37:04  profilanswer
 

Bonjour.  
 
Voila mon code voir en dessous pour ce que je veux faire :
 
On Error Resume Next
 
Set objSysInfo = CreateObject("ADSystemInfo" )
Set objNetwork = CreateObject("Wscript.Network" )
 
strUserPath = "LDAP://" & objSysInfo.UserName
'strRemotePath = "\\" & Computername & "\C$\subst"
Set objUser = GetObject(strUserPath)
objNetwork.MapNetworkDrive "Z:", "\\abp-cdi-svr-f01\User Folder\%username%"
 
For Each strGroup in objUser.MemberOf
    strGroupPath = "LDAP://" & strGroup
    Set objGroup = GetObject(strGroupPath)
    strGroupName = objGroup.CN
 
    Select Case strGroupName
        Case "information technology"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Information Technology"
  Case "Recovery Service"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Recovery Service"
  Case "Adzope Branch"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Adzope Branch"
  Case "Commercial banking"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Commercial banking"
  Case "Corporate banking"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Corporate Banking"
  Case "Customer Service"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Customer Service"
  Case "Financial Service"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Financial Service"
  Case "General Service"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\General Service"
  Case "Hayat Branch"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Hayet Branch"
  Case "Human resources"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Human resources"
  Case "Compliance Internal Control"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Compliance Internal Control"
  Case "Legal"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Legal"
  Case "Operation Unit"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Operation unit"
  Case "Prima Branch"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Prima Branch"
  Case "Retail Banking"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Retail Banking"
  Case "Risk Management"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Risk management"
 Case "Roiser Branch"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Roiser Branch"
 Case "Treasury"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\Treasury"
 Case "allcotedivoireusers"
            objNetwork.MapNetworkDrive "W:", "\\abp-cdi-svr-f01\Departmental Folder\General Share Folder"
End Select
Next
 
En fait j'ai éditer ce script dans un policy sur Active directory à chaque logon de l'utilisateur. Le problème c'est que ça ne fonctionne pas.
SVP pourriez-vous m'aider?
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  [RESOLU] [VBS] Probleme script vbs

 

Sujets relatifs
Problème de compatibilité javascript/IEProbleme avec mon fichier batch
petit script pour eteindre un serveur du reseauProblème lien
[RESOLU]Identification 'un peu intelligente'[Résolu] - [SQL] probleme de requetage
Help me : problème de date/heure du moment en php[python]transformer une ip hex en decimal [résolu]
afficher une image probleme 
Plus de sujets relatifs à : [RESOLU] [VBS] Probleme script vbs


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR