Inquiridor
Script de Mapeamento de Rede conforme usuario e grupo de usuario

Discussão Geral
-
Ola pessoa,
Tenho a seguinte estrutura:
Windows 2016 server com AD e estaçoes com windows 7 e 10 e mais de 30 usuarios
O que preciso:
criar um script de logon que mapeie as unidades de rede conforme:
P: \\fileserver\public todos os usuários terão acesso
V: \\fileserver\usuario\NOMEDOUSUARIO <--- aqui é para mapear somente o usuario que logar.
F: \\fileserver\DEPARTAMENTO <--- aqui vai mapear conforme o grupo que o usario pertence
aqui tenho um problem que eu participo do departamento Gerencial, TI, administrativo, financeiro preciso que meu F seja o gerencial, mas que crie um H: para TI, I: para Administrativo, J: para financeiro e assim por diante.
Até encontrei um script que faz essa parte do departamento, mas não consegui fazer funcionar caso o usuario participe de mais que um grupo.
Todas as Respostas
-
-
Boa tarde. Especifico pra mais de um grupo sera dificil de encontrar. Pois como ira proceder, se o usuario pertence a mais de um grupo o mesmo mapeamento ?
O que vc pode fazer é deixar pre-definido os mapeamentos (letras e unidades) e caso o usuario pertença a todos eles o script é executado de acordo com o grupo que pertence...mas pra isso precisara de 3 ou mais Scripts ou 3 ou mais GPO's.
Se útil, por favor Classifique João C.X.Macedo Specialist Platforms Microsoft MCP,MCT,MCSA,MCTS,MCITP, ENTERPRISE VIRTUALIZATION WINDOWS SERVER 2008 R2,MCSE WINDOWS SERVER 2012,MCSA WINDOWS SERVER 2016
-
pensei em algo, tipo esse abaixo.... mas ai com um If Not FSODrive.DriveExists(“F:”) Then usar um else..
On Error Resume Next
set objNetwork= CreateObject(“WScript.Network”)
strDom = objNetwork.UserDomain
strUser = objNetwork.UserName
Set objUser = GetObject(“WinNT://” & strDom & “/” & strUser & “,user”)
objNetwork.MapNetworkDrive “P:”, “\\fileserver\public\”
objNetwork.MapNetworkDrive “V:”, “\\fileserver\usuario\” & strUser
For Each objGroup In objUser.Groups
Select Case objGroup.Name
Case “Contabil”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Contabil”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Contabil.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Departamento Pessoal”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\DP”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\DP.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Fiscal”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Fiscal”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Fiscal.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Gerencia”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Gerencia”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Gerencia.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Juridico”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Juridico”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Juridico.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Legalizacao”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Legalizacao”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Legalizacao.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Lideres”
If Not FSODrive.DriveExists(“L:”) Then
objNetwork.MapNetworkDrive “L:”, “\\FileServer\Lideres”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Lideres.lnk”)
oShellLink.TargetPath =”L:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Logistica”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Logistica”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Logistica.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Recepcao”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Recepcao”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Recepcao.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “TI”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Informatica”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Informatica.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Transporte”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Transporte”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Transporte.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Administrativo”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Administrativo”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Administrativo.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4″
oShellLink.Save
End If
Case “Comercial”
If Not FSODrive.DriveExists(“F:”) Then
objNetwork.MapNetworkDrive “F:”, “\\FileServer\Comercial”
Set WshShell = WScript.CreateObject(“WScript.Shell”)
strDesktop = WshShell.SpecialFolders(“Desktop”)
Set oShellLink = WshShell.CreateShortcut(strDesktop & “\Comercial.lnk”)
oShellLink.TargetPath =”F:”
oShellLink.WindowStyle = 3
oShellLink.IconLocation = “%SystemRoot%\system32\SHELL32.dll, 4”
oShellLink.Save
End If
End Select
Next
wscript.quit