none
Script Vbs para mapear unidade de rede,copiar arquivos e adicionar impressora por grupo RRS feed

  • Pergunta

  • Seguinte galera tenho um script aqui em vbs que a finalidade dele é mapear as unidade de rede, adicionar impressora e copiar arquivo a ideia era ele fazer isso pelo grupo que o usuario se encontra no AD só que ele nunca funcionou e nao consigo achar o erro dele. Queria que o script tb adicionava nas variáveis de ambiente o TNS da conexão com o ORACLE. Vou postar o script e gostaria da ajuda de vcs para identificar pq ele não funciona e caso alguem tenha um script que faça o que preciso pode postar ai que vai ser muito bem vindo e utilizado.

     

    Meu windows é o Server 2008 no DC e nas estações windosws XP, Vista e 7.

     

     

     

    Const GG_1 = "cn=cpd"

    Const GG_2 = "cn=contabilidade"

    Const GG_3 = "cn=conferencia"

    Const GG_4 = "cn=diretoria"

    Const GG_5 = "cn=estoque"

    Const GG_6 = "cn=financeiro"

    Const GG_7 = "cn=marketing"

    Const GG_8 = "cn=mc"

    Const GG_9 = "cn=rh"

    Const GG_10 = "cn=rio de premios"

    Const GG_11 = "cn=secretaria"

    Const GG_12 = "cn=tesouraria"

    Const GG_13 = "cn=ti"

    Const GG_14 = "cn=vendas"

    Const GG_15 = "cn=telemarketing"

     

     

     

     

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    set WshShell = CreateObject("WScript.Shell")

    Set wshNetwork = CreateObject("WScript.Network")

    Set oDrives = WshNetwork.EnumNetworkDrives

    Set ADSysInfo = CreateObject("ADSystemInfo")

    wscript.echo ADSysInfo.UserName 

    Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)

    DriveMapper "G:"

    DriveMapper "H:"

    DriveMapper "I:"

    DriveMapper "J:"

    DriveMapper "K:"

    DriveMapper "L:"

    DriveMapper "M:"

    DriveMapper "N:"

    DriveMapper "O:"

    DriveMapper "P:"

    DriveMapper "Q:"

    DriveMapper "R:"

    DriveMapper "S:"

    DriveMapper "T:"

    DriveMapper "U:"

    DriveMapper "V:"

    DriveMapper "X:"

    DriveMapper "Y:"

    DriveMapper "W:"

     

     

    arrMembersOf = CurrentUser.GetEx("memberOf")

    For Each strMembro in arrMembersOf

        mapear strMembro

        subGrupo strMembro

    Next

     

    '=========================================

     

     

    sub subgrupo(strcaminho)

     

    Set objGroup = GetObject("LDAP://" & strCaminho)

    objGroup.GetInfo

     

    'arrSubMembro = objGroup.GetEx("memberOf")

    arrSubMembro = objGroup.GetEx("member")

     

    For Each strSubMember in arrSubMembro

       mapear strSubMember

    Next

     

    end sub

     

    '===========================================

     

    Sub DriveMapper(Drive)

    For i = 0 to oDrives.Count -1 Step 2

       if LCase(Drive) = LCase(oDrives.Item(i)) then

          WshNetwork.RemoveNetworkDrive Drive, true, true

       End if

    Next

     

    End sub

     

    '============================================================================

    'Sincroniza o horario da estacao com o servidor

     

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

    Set objShell = CreateObject("WScript.shell")

    strCmd = "net time \\hebdca /set /yes"

    set objexec = objshell.exec(strcmd)

     

    '===============Mapeando Unidade de Rede=============================

     

    Sub Mapear(strGrupoFIM)

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_1)) Then

      wshNetwork.MapNetworkDrive "G:", "\\192.168.1.2\compartilhamento1"

    End if

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_2)) Then

       wshNetwork.MapNetworkDrive "H:", "\\192.168.1.2\compartilhamento2"

    End if

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_3)) Then

          wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\publica"

          wshNetwork.MapNetworkDrive "R:", "\\192.168.1.2\cpd"

          wshNetwork.MapNetworkDrive "V:", "\\192.168.1.2\conferencia"

     

     

    '===============Adicionando Impressoras==========================

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\hebdca-imp0001"

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\hebdca-imp0002"

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\hebdca-imp0003"

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\hebdca-imp0004"

     

     

    WshNetwork.SetDefaultPrinter "\\192.168.1.2\hebdca-imp0001"

     

    '===============Criando atalho no Desktop==========================

     

     

    IF Not objFSO.FileExists("C:\Documents and Settings\All Users\Desktop\loterj.ink") THEN

    objFSO.CopyFile "\\192.168.1.2\NETLOGON\loterj.lnk" , "C:\Documents and Settings\All Users\Desktop\"

    End If

     

    '===============Adicionando DLL/OCX no system32====================

     

     

     

    '=================Bloqueando USB===================================

     

    Set objShell = CreateObject("Wscript.Shell")

    objShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start","4","REG_DWORD"

    End if

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_4)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_5)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_6)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_7)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_8)) Then

      wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_9)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_10)) Then

      wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_11)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_12)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_13)) Then

       wshNetwork.MapNetworkDrive "G:", "\\192.168.1.2\ti"

       wshNetwork.MapNetworkDrive "H:", "\\192.168.1.2\marketing"

       wshNetwork.MapNetworkDrive "I:", "\\192.168.1.2\financeiro"

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\publica"

       wshNetwork.MapNetworkDrive "K:", "\\192.168.1.2\tesouraria"

       wshNetwork.MapNetworkDrive "L:", "\\192.168.1.2\vendas"

       wshNetwork.MapNetworkDrive "M:", "\\192.168.1.2\estoque"

       wshNetwork.MapNetworkDrive "N:", "\\192.168.1.2\diretoria"

       wshNetwork.MapNetworkDrive "O:", "\\192.168.1.2\telemarketing"

       wshNetwork.MapNetworkDrive "P:", "\\192.168.1.2\software"

       wshNetwork.MapNetworkDrive "Q:", "\\192.168.1.2\rh"

       wshNetwork.MapNetworkDrive "R:", "\\192.168.1.2\cpd"

       wshNetwork.MapNetworkDrive "S:", "\\192.168.1.2\contabilidade"

       wshNetwork.MapNetworkDrive "T:", "\\192.168.1.2\mc"

       wshNetwork.MapNetworkDrive "U:", "\\192.168.1.2\secretaria"

       wshNetwork.MapNetworkDrive "V:", "\\192.168.1.2\conferencia"

       wshNetwork.MapNetworkDrive "X:", "\\192.168.1.2\ti"

     

    '===============Adicionando Impressoras==========================

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\heb-imp0001"

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\heb-imp0002"

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\heb-imp0003"

     

    WshNetwork.AddWindowsPrinterConnection "\\192.168.1.2\heb-imp0004"

     

     

    WshNetwork.SetDefaultPrinter "\\192.168.1.2\heb-imp0001"

     

    '===============Criando atalho no Desktop==========================

     

     

    IF Not objFSO.FileExists("C:\Documents and Settings\All Users\Desktop\loterj.ink") THEN

    objFSO.CopyFile "\\192.168.1.2\NETLOGON\loterj.lnk" , "C:\Documents and Settings\All Users\Desktop\"

    End If

     

    '===============Adicionando DLL/OCX no system32====================

     

     

     

     

    '=================Bloqueando USB===================================

     

    Set objShell = CreateObject("Wscript.Shell")

    objShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start","4","REG_DWORD"

     

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_14)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

    If InStr(UCASE(strGrupoFIM), UCASE(GG_15)) Then

       wshNetwork.MapNetworkDrive "J:", "\\192.168.1.2\compartilhamento4"

    End If

     

     

    End Sub


     

    quinta-feira, 17 de fevereiro de 2011 12:15

Respostas

  • Segue exemplo de impressoras

    On Error Resume Next
    'Script para Impressoras

    Set objSysInfo = CreateObject("ADSystemInfo")
    Set objNetwork = CreateObject("Wscript.Network")
    set objShell = CreateObject("WScript.Shell")
    Set wshShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    '**** Remove Impressoras'
    objNetwork.RemovePrinterConnection "\\printserver\almox_pb"

    '**** Mapeamento de Impressoras
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    For Each strGroup in objUser.MemberOf
      strGroupPath = "LDAP://" & strGroup
      Set objGroup = GetObject(strGroupPath)
      strGroupName = objGroup.CN
      Select Case strGroupName
    ''    Case "Remove Impressoras"
    ''      Dim colInstalledPrinters
    ''      strComputer = "."
    ''      Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    ''      Set colInstalledPrinters =  objWMIService.ExecQuery ("Select ShareName from Win32_Printer Where ServerName Like '%printserver%' AND Network = True")
    ''      For Each objItem in colInstalledPrinters
    ''        objItem.Delete_
    ''      Next
         '**** Mapeamento de Impressoras'
        Case "Impressora AMBULATORIO"
          objNetwork.AddWindowsPrinterConnection "\\printserver\AMBULATORIO"
         End Select
    Next
    WScript.Sleep 5000 

    'Define Impressoras como Padrão'
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    For Each strGroup in objUser.MemberOf
      strGroupPath = "LDAP://" & strGroup
      Set objGroup = GetObject(strGroupPath)
      strGroupName = objGroup.CN
      Select Case strGroupName     
        '**** Mapeia impressoras Padrões ******************************************************'
        Case "Impressora Padrao AMBULATORIO"
          objNetwork.SetDefaultPrinter "\\printserver\AMBULATORIO"
        End Select
    Next


    Thomas Edson Mattos Roeder
    segunda-feira, 21 de fevereiro de 2011 18:11

Todas as Respostas

  • Segue exemplo de impressoras

    On Error Resume Next
    'Script para Impressoras

    Set objSysInfo = CreateObject("ADSystemInfo")
    Set objNetwork = CreateObject("Wscript.Network")
    set objShell = CreateObject("WScript.Shell")
    Set wshShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    '**** Remove Impressoras'
    objNetwork.RemovePrinterConnection "\\printserver\almox_pb"

    '**** Mapeamento de Impressoras
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    For Each strGroup in objUser.MemberOf
      strGroupPath = "LDAP://" & strGroup
      Set objGroup = GetObject(strGroupPath)
      strGroupName = objGroup.CN
      Select Case strGroupName
    ''    Case "Remove Impressoras"
    ''      Dim colInstalledPrinters
    ''      strComputer = "."
    ''      Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    ''      Set colInstalledPrinters =  objWMIService.ExecQuery ("Select ShareName from Win32_Printer Where ServerName Like '%printserver%' AND Network = True")
    ''      For Each objItem in colInstalledPrinters
    ''        objItem.Delete_
    ''      Next
         '**** Mapeamento de Impressoras'
        Case "Impressora AMBULATORIO"
          objNetwork.AddWindowsPrinterConnection "\\printserver\AMBULATORIO"
         End Select
    Next
    WScript.Sleep 5000 

    'Define Impressoras como Padrão'
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    For Each strGroup in objUser.MemberOf
      strGroupPath = "LDAP://" & strGroup
      Set objGroup = GetObject(strGroupPath)
      strGroupName = objGroup.CN
      Select Case strGroupName     
        '**** Mapeia impressoras Padrões ******************************************************'
        Case "Impressora Padrao AMBULATORIO"
          objNetwork.SetDefaultPrinter "\\printserver\AMBULATORIO"
        End Select
    Next


    Thomas Edson Mattos Roeder
    segunda-feira, 21 de fevereiro de 2011 18:11
  • Segue exmplor para arquivos, copia etc

     

    On Error Resume Next

    Set objSysInfo = CreateObject("ADSystemInfo")
    Set wshShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objNetwork = CreateObject("Wscript.Network")
    Dim strProgFiles, strWinDir
    strWinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
    strProgFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

    '************  Carrega Variaveis com dados de Memoria, S.O, etc... , para usar nas rotinas abaixo'
    Dim objWMIService,objItem
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Dim strSistOper, strMemoria, strUsuario
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem", , 48)
    For Each objItem In colItems
      strSistOper = Trim(objItem.Caption)
    Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory", , 48)
    For Each objItem in colItems
      strMemoria = (objItem.Capacity)
    Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
    For Each objItem In colItems
      strUsuario = Trim(objNetwork.UserName)
    Next
    Set WshShell = Nothing

    '*************  Manutenção de Arquivos
    Const OverwriteExisting = True

    '**** Pasta SO'
    If objFSO.FolderExists("c:\lis") Then
      objFSO.CopyFile "\\PANORAMICO\netlogon\arquivos\Kix*.*", strWindir , OverwriteExisting
      objFSO.CopyFile "\\PANORAMICO\netlogon\arquivos\Kx*.dll", strWindir , OverwriteExisting
      objFSO.CopyFile "\\PANORAMICO\netlogon\arquivos\KIX181207.txt", "c:\LIS\" , OverwriteExisting
      objFSO.CopyFile "\\micruss\aplicativos\SUPORTE\I.EXE", "c:\LIS\" , OverwriteExisting
      objFSO.CopyFile "\\micruss\aplicativos\SUPORTE\desktop\bussc*.jpg", "c:\lis\" , OverwriteExisting
      objFSO.CopyFile "\\micruss\aplicativos\suporte\desktop\logo_b*.bmp", "c:\lis\" , OverwriteExisting
      objFSO.CopyFile "\\micruss\aplicativos\SUPORTE\DESKTOP\arq.txt", "c:\lis\jinit01183.TXT" , OverwriteExisting
      Else
       objFSO.CreateFolder("C:\Lis")
    End If
    '**** Geral '
    objFSO.DeleteFile ("C:\Documents and Settings\"&objNetwork.UserName&"\Configurações locais\Temp\*.*"),True
    objFSO.DeleteFolder ("C:\Documents and Settings\"&objNetwork.UserName&"\Configurações locais\Temp\*"),True
    objFSO.DeleteFile ("C:\Documents and Settings\"&objNetwork.UserName&"\Configurações locais\Temp\totvs*.*"),True
    objFSO.DeleteFile ("C:\Documents and Settings\"&objNetwork.UserName&".intranet\Configurações locais\Temp\totvs*.*"),True
    objFSO.DeleteFile ("C:\Documents and Settings\"&objNetwork.UserName&"\Menu Iniciar\Programas\Inicializar\AM-WorkFlow Fast Load.lnk"),True
    objFSO.DeleteFile ("C:\Documents and Settings\All Users\Menu Iniciar\Programas\Inicializar\AM-WorkFlow Fast Load.lnk"),True
    objFSO.DeleteFile (strWindir&"\system32\intranet*.*"),True
    objFSO.DeleteFile (strWindir&"\web\safemode.htt"),True
    objFSO.DeleteFile (strWindir&"\system32\winmine.exe"),True
    objFSO.DeleteFile (strWindir&"\system32\freecell.exe"),True
    objFSO.DeleteFile (strWindir&"\system32\sol.exe"),True
    objFSO.DeleteFile (strWindir&"\system32\spider.exe"),True
    objFSO.DeleteFile (strWindir&"\system32\mbosync.exe"),True
    objFSO.DeleteFile (strProgFiles&"\Windows NT\Pinball\PINBALL.EXE"),True
    objFSO.CopyFile "\\panoramico\netlogon\arquivos\ADVC128B.TTF", strWindir&"\fonts" , OverwriteExisting
    objFSO.CopyFile "\\micruss\aplicativos\SUPORTE\DESKTOP\arq.txt", strWindir&"\jinit01183.TXT" , OverwriteExisting
    objFSO.CopyFile "\\micruss\aplicativos\suporte\screensaver\ok\busscar*.*", strWindir&"\system32" , OverwriteExisting
    objFSO.CopyFile "\\micruss\aplicativos\suporte\screensaver\ok\tecno*.*", strWindir&"\system32" , OverwriteExisting
    '**** Arquivos NX'
    If objFSO.FolderExists("c:\ugnx5") Then
      objFSO.DeleteFile ("c:\ugnx5\PVTRANS\tessUG.config"),True
      WScript.Sleep 2000
      objFSO.CopyFile "\\Micruss\dados\CAD\nx\ugnx5\*.*", "c:\ugnx5" , OverwriteExisting
      objFSO.CopyFile "\\Micruss\dados\CAD\nx\ugnx5\DXFDWG\*.*", "c:\ugnx5\DXFDWG" , OverwriteExisting
      objFSO.CopyFile "\\micruss\dados\cad\nx\ugnx5\PVTRANS\*.*", "c:\ugnx5\PVTRANS\" , OverwriteExisting
      objFSO.CopyFile "\\Micruss\dados\CAD\nx\ugnx5\busscar\", "c:\ugnx5\busscar\" , OverwriteExisting
      objFSO.CopyFile "\\Micruss\dados\CAD\nx\ugnx5\UGII\menus\roles\*.*", "c:\ugnx5\UGII\menus\roles\" , OverwriteExisting
      objFSO.CopyFile "\\Micruss\dados\CAD\nx\ugnx5\UGII\*.dat", "c:\ugnx5\UGII\" , OverwriteExisting
      objFSO.CopyFile "\\Micruss\dados\CAD\nx\ugnx5\UGII\ug*.*", "c:\ugnx5\UGII\" , OverwriteExisting
    End If
    If objFSO.FileExists(strProgFiles&"\UGS\JT2Go\mfc71.dll") Then
      objFSO.CopyFile "\\panoramico\NETlogon\arquivos\mfc71.dll", strProgFiles&"\UGS\JT2Go\" , OverwriteExisting
    End If
    If objFSO.FileExists(strProgFiles&"\UGS\JT2Go\mfc71.dll") Then
      objFSO.CopyFile "\\panoramico\NETlogon\arquivos\mfc71.dll", strProgFiles&"\UGS\JT2Go\" , OverwriteExisting
    End If
    '**** Arquivos ORACLE'
    If objFSO.FolderExists("c:\ORANT") Then
      objFSO.CopyFile "\\Micruss\aplicativos\suporte\desktop\oracle\*.*", "C:\orant\NET80\ADMIN" , OverwriteExisting
      objFSO.CopyFile "\\Micruss\aplicativos\suporte\desktop\oracle\*.*", "C:\orant\NETWORK\ADMIN" , OverwriteExisting
      objFSO.CopyFile "\\panoramico\netlogon\arquivos\oracle\fmrusw*.*", "C:\orant\forms60" , OverwriteExisting
      objFSO.CopyFile "\\panoramico\netlogon\arquivos\oracle\d2kwut60*.*", "C:\orant\bin" , OverwriteExisting
      objFSO.CopyFile "\\panoramico\netlogon\arquivos\oracle\m*.*", strWindir&"\system32" , OverwriteExisting
    End If
    If objFSO.FolderExists("c:\Oracle") Then
      objFSO.CopyFile "\\micruss\aplicativos\suporte\desktop\oracle\*.ora", "C:\Oracle\product\10.1.0\Client_1\NETWORK\ADMIN" , OverwriteExisting
      objFSO.CopyFile "\\micruss\aplicativos\suporte\desktop\oracle\*.ora", "C:\Oracle\product\11.1.0\Client_1\NETWORK\ADMIN" , OverwriteExisting
    End If
    If objFSO.FolderExists("c:\Oracle11") Then
      objFSO.CopyFile "\\micruss\aplicativos\suporte\desktop\oracle\*.ora", "C:\Oracle\product\10.1.0\Client_1\NETWORK\ADMIN" , OverwriteExisting
    End If
    If objFSO.FolderExists("c:\Ora8i") Then
      objFSO.CopyFile "\\micruss\aplicativos\suporte\desktop\oracle\*.ora", "C:\ORA8i\NETWORK\ADMIN" , OverwriteExisting
    End If
    If objFSO.FolderExists("c:\Oracle8") Then
      objFSO.CopyFile "\\micruss\aplicativos\suporte\desktop\oracle\*.ora", "C:\ORACLE8\NETWORK\ADMIN" , OverwriteExisting
    End If
    '**** Arquivos BrOffice'
    If objFSO.FolderExists(strProgFiles & "\BrOffice.org 2.4") Then
      objFSO.DeleteFile ("C:\Documents and Settings\"&objNetwork.UserName&"\Menu Iniciar\Programas\Inicializar\BrOffice*.*"),True
      objFSO.CopyFile "\\panoramico\netlogon\arquivos\openoffice2.txt", "c:\documents and settings\"&objNetwork.UserName&"\dados de aplicativos\" , OverwriteExisting
      objFSO.CopyFolder "\\panoramico\netlogon\arquivos\broffice.org2\*.*", "c:\documents and settings\"&objNetwork.UserName&"\dados de aplicativos\broffice.org2\" , OverwriteExisting
    End If

    'Wscript.Echo strProgFiles
    'Wscript.Echo strWinDir
    If objFSO.FolderExists(strProgFiles & "\BrOffice.org 3") Then
      objFSO.DeleteFile ("C:\Documents and Settings\"&objNetwork.UserName&"\Menu Iniciar\Programas\Inicializar\BrOffice*.*"),True
      objFSO.CopyFile "\\panoramico\netlogon\arquivos\broffice3_02.txt", "c:\documents and settings\"&objNetwork.UserName&"\dados de aplicativos\" , OverwriteExisting
      objFSO.CopyFile "\\panoramico\netlogon\arquivos\broffice_program\soffice.ini", "c:\Arquivos de programas\BrOffice.org 3\program" , OverwriteExisting
      objFSO.CopyFolder "\\panoramico\netlogon\arquivos\broffice.org\*.*", "c:\documents and settings\"&objNetwork.UserName&"\dados de aplicativos\broffice.org\" , OverwriteExisting
    End If
    'If (strUsuario="testecad") Then
    ''  objFSO.CopyFolder "c:\Documents and Settings\testecad\Meus Documentos\*.*", "\\panoramico\salva$\thomas\teste\" , OverwriteExisting
    ''  objFSO.CopyFile "c:\Documents and Settings\testecad\Meus Documentos\*.*", "\\panoramico\salva$\thomas\teste" , OverwriteExisting
    'End If
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    For Each strGroup in objUser.MemberOf
      strGroupPath = "LDAP://" & strGroup
      Set objGroup = GetObject(strGroupPath)
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objNetwork = CreateObject("Wscript.Network")
      strGroupName = objGroup.CN
      Select Case strGroupName   
        Case "Tecnofibras"
          If objFSO.FolderExists("c:\Wordviewer") Then
            objFSO.CopyFolder "\\terra\Protheus10\Diversos\Wordviewer\*.*", "c:\Wordviewer\" , OverwriteExisting
          Else
            objFSO.CreateFolder("C:\Wordviewer")
        End If
      End Select
    Next


    Thomas Edson Mattos Roeder
    segunda-feira, 21 de fevereiro de 2011 18:12