![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Logon Script Buenas tardes, Necesito ayuda para realizar un script que me permita seleccionar en usuario que se logonea y que proceda de una determinada manera según quien se logonee. Ej: Si es el usuario "juan" entonces mapea h: \\servidor\home mapea x: \\servidor\compras fin si Si es el usuario "pedro" entonces mapea h: \\servidor\home mapea p: \\servidor\servicios fin sin Muchas gracias! Martín. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Logon Script "Martín Companucci" <companucci@xxxxxx> wrote in message news:64135B8E-4BE3-4A7A-A536-BBECD55A522D@xxxxxx Quote: > Buenas tardes, > > Necesito ayuda para realizar un script que me permita seleccionar en > usuario > que se logonea y que proceda de una determinada manera según quien se > logonee. > Ej: > > Si es el usuario "juan" entonces > mapea h: \\servidor\home > mapea x: \\servidor\compras > fin si > > Si es el usuario "pedro" entonces > mapea h: \\servidor\home > mapea p: \\servidor\servicios > fin sin > > Muchas gracias! > Martín. > solution. It assumes that user JDoe has a share called \\Server\JDoe and that user ASmith has a share \\Server\ASmith. 1. In your logon script you insert these lines: @echo off net use h: \\Server\home if exist \\Server\%UserName%\netlogon\netlogon.bat call \\Server\%UserName%\netlogon\netlogon.bat 2. You create this file, here shown for user JDoe: \\Server\JDoe\netlogon\netlogon.bat Inside this file you put the user-specific share commands: net use P: \\Server\servicios net use S: \\Server\sales etc. 3. If you wish then you can hide the folder \\Server\JDoe\netlogon\. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Logon Script On Oct 8, 2:27*pm, "Martín Companucci" <companu...@xxxxxx> wrote: Quote: > Buenas tardes, > > Necesito ayuda para realizar un script que me permita seleccionar en usuario > que se logonea y que proceda de una determinada manera según quien se > logonee. > Ej: > > Si es el usuario "juan" entonces > * * *mapea h: \\servidor\home > * * *mapea x: \\servidor\compras > fin si > > Si es el usuario "pedro" entonces > * * mapea h: \\servidor\home > * * mapea p: \\servidor\servicios > fin sin > > Muchas gracias! > Martín. varaiables for s vbscript solution On Error Resume Next '// Dims Variables Dim objFSO,objSysInfo Dim WshNetwork,WshShell Dim strUserDN,strDrive '// Sets Stuff Set objFSO = CreateObject("Scripting.FileSystemObject") Set objSysInfo = CreateObject("ADSystemInfo") set WshNetwork = CreateObject("Wscript.Network") Set WshShell = CreateObject("WScript.Shell") strUserDN = WshNetwork.username strHDrive = "H:" StrHData = "\\servidor\home" strXDrive = "X:" StrXData = "\\servidor\compras" strPDrive = "P:" StrPData = "\\servidor\servicios" 'Call debug 'Used to debug user login information ''''''''' Starts Login Script ''''''''' if strUserDN = "juan" then WshNetwork.RemoveNetworkDrive strHDrive 'Removes H Network Drive Upon Login WshNetwork.MapNetworkDrive strHDrive, strHData 'Adds H Network Drive Upon Login WshNetwork.RemoveNetworkDrive strXDrive 'Removes X Network Drive Upon Login WshNetwork.MapNetworkDrive strXDrive, strXData 'Adds X Network Drive Upon Login elseif strUserDN = "pedro" then WshNetwork.RemoveNetworkDrive strHDrive 'Removes H Network Drive Upon Login WshNetwork.MapNetworkDrive strHDrive, strHData 'Adds H Network Drive Upon Login WshNetwork.RemoveNetworkDrive strPDrive 'Removes X Network Drive Upon Login WshNetwork.MapNetworkDrive strPDrive, strPData 'Adds X Network Drive Upon Login end if Function debug wscript.echo "Username: " & strUserDN wscript.echo "UserPath: WinNT://" & strADDN & "/" & strGroupDN End Function '// Closes Stuff Set objFSO = Nothing Set objSysInfo = Nothing set WshNetwork = Nothing Set WshShell = Nothing |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Logon Script "Martín Companucci" <companucci@xxxxxx> wrote in message news:64135B8E-4BE3-4A7A-A536-BBECD55A522D@xxxxxx Quote: > Buenas tardes, > > Necesito ayuda para realizar un script que me permita seleccionar en > usuario > que se logonea y que proceda de una determinada manera según quien se > logonee. > Ej: > > Si es el usuario "juan" entonces > mapea h: \\servidor\home > mapea x: \\servidor\compras > fin si > > Si es el usuario "pedro" entonces > mapea h: \\servidor\home > mapea p: \\servidor\servicios > fin sin map your drive. Try the code below as an example: '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Option Explicit Dim oWNT, oFSO, oDrives, sUsername, sDrive, sPath, sMapping Set oWNT = CreateObject("WScript.Network") Set oFSO = CreateObject("Scripting.FileSystemObject") Set oDrives = CreateObject("Scripting.Dictionary") oDrives.CompareMode = 1 'Case insensitive text compare ' Add your users to the dictionary. Separate mappings ' with the pipe (|) symbol '____________________________________________________________ oDrives("juan") = "H:/Home|X:\\servidor\compras" oDrives("pedro") = "H:/Home|P:\\servidor\servicios" '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ sUsername = oWNT.Username For Each sMapping in Split(oDrives(sUsername), "|") sDrive = Split(sMapping, ":")(0) & ":" sPath = Split(sMapping, ":")(1) If LCase(sPath) = "/home" Then sPath = FindHome(sUsername) If oFSO.DriveExists(sDrive) Then If oFSO.GetDrive(sDrive).DriveType = 3 Then oWNT.RemoveNetworkDrive sDrive, True End If End If oWNT.MapNetworkDrive sDrive, sPath, False Next Function FindHome(ByVal sUsername) Dim oWSH, sDomain, oUser Set oWSH = CreateObject("WScript.Shell") sDomain = oWSH.Environment("Process").Item("UserDomain") Set oUser = GetObject("WinNT://" & sDomain & "/" & sUsername) FindHome = oUser.HomeDirectory End Function '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Logon Script Thanks for your help! "Martín Companucci" <companucci@xxxxxx> escribió en el mensaje de noticias:64135B8E-4BE3-4A7A-A536-BBECD55A522D@xxxxxx | Buenas tardes, | | Necesito ayuda para realizar un script que me permita seleccionar en usuario | que se logonea y que proceda de una determinada manera según quien se | logonee. | Ej: | | Si es el usuario "juan" entonces | mapea h: \\servidor\home | mapea x: \\servidor\compras | fin si | | Si es el usuario "pedro" entonces | mapea h: \\servidor\home | mapea p: \\servidor\servicios | fin sin | | Muchas gracias! | Martín. | | |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Logon script | PowerShell | |||
| Logon Script Causing Laptops To Hang - Problems in script? | VB Script | |||
| Logon script is not visible | Vista networking & sharing | |||
| Logon Script - VBScript | Vista General | |||
| Logon Script | Vista General | |||