LOGIN SCRIPT
- From: erikzwep@xxxxxxxxx
- Date: 10 Mar 2006 02:31:33 -0800
Here is my script:
The new script!
' VBScript logon script program.
'
'
----------------------------------------------------------------------
' Copyright (c) 2006 Exploitatie Maatschappij Bieze bv
' Version 1.0 - Maart 2006
Option Explicit
Dim objNetwork, objSysInfo, strUserDN
Dim objGroupList, objUser, objFSO
Dim strComputerDN, objComputer
Dim WshShell, SHell
Dim oFS, oWS
Dim strHomeDrive
Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
strComputerDN = objSysInfo.computerName
Set WshShell = WScript.CreateObject("WScript.Shell")
Set Shell = CreateObject("Shell.Application")
Set oWS = WScript.CreateObject("WScript.Shell")
Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
' Bind to the user and computer objects with the LDAP provider.
Set objUser = GetObject("LDAP://" & strUserDN)
Set objComputer = GetObject("LDAP://" & strComputerDN)
'NEPTUNUS
' Map a network drive if the user is a member of the group.
If IsMember(objUser, "dlNpPS-R") Then
objNetwork.MapNetworkDrive "F:", "\\en-dc01\Persoonlijk Neptunus\" &
objNetwork.UserName ,True
End If
If IsMember(objUser, "dlNpGZ-R") Then
objNetwork.MapNetworkDrive "G:", "\\en-dc01\Gezamenlijk Neptunus" ,True
End If
If IsMember(objUser, "dlNpAPPL-R") Then
objNetwork.MapNetworkDrive "H:", "\\en-dc01\Appl Neptunus" ,True
End If
If IsMember(objUser, "dlNpINSTAL-R") Then
objNetwork.MapNetworkDrive "I:", "\\en-dc01\Installatie Neptunus" ,True
End If
'Outlook
Const sOrgFile = "c:\documents and settings\%username%\Outlook.txt"
If IsFile(sOrgFile) Then
'Nothing
Else
WshShell.Run "OUTLOOK.EXE /importprf
\\biezegroep.net\sysvol\BIEZEGROEP.NET\scripts\Neptunus\Inlog\NPoutlook.prf"
,True
On Error Resume Next
End If
' Clean up.
Set objNetwork = Nothing
Set objFSO = Nothing
Set objSysInfo = Nothing
Set objGroupList = Nothing
Set objUser = Nothing
Set objComputer = Nothing
Set oWS = Nothing
Set oFS = Nothing
Function IsMember(objADObject, strGroup)
' Function to test for group membership.
' objGroupList is a dictionary object with global scope.
If IsEmpty(objGroupList) Then
Set objGroupList = CreateObject("Scripting.Dictionary")
End If
If Not objGroupList.Exists(objADObject.sAMAccountName & "\") Then
Call LoadGroups(objADObject, objADObject)
objGroupList(objADObject.sAMAccountName & "\") = True
End If
IsMember = objGroupList.Exists(objADObject.sAMAccountName & "\" _
& strGroup)
End Function
Function IsFile(fName)
On Error Resume Next
If oFS.FileExists(fName) Then IsFile = True Else IsFile = False
On Error Goto 0
End Function
Sub LoadGroups(objPriObject, objADSubObject)
' Recursive subroutine to populate dictionary object objGroupList.
Dim colstrGroups, objGroup, j
objGroupList.CompareMode = vbTextCompare
colstrGroups = objADSubObject.memberOf
If IsEmpty(colstrGroups) Then
Exit Sub
End If
If TypeName(colstrGroups) = "String" Then
Set objGroup = GetObject("LDAP://" & colstrGroups)
If Not objGroupList.Exists(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) Then
objGroupList(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) = True
Call LoadGroups(objPriObject, objGroup)
End If
Set objGroup = Nothing
Exit Sub
End If
For j = 0 To UBound(colstrGroups)
Set objGroup = GetObject("LDAP://" & colstrGroups(j))
If Not objGroupList.Exists(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) Then
objGroupList(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) = True
Call LoadGroups(objPriObject, objGroup)
End If
Next
Set objGroup = Nothing
End Sub
AND my new problem:
'Outlook
Const sOrgFile = "c:\documents and settings\%username%\Outlook.txt"
If IsFile(sOrgFile) Then
'Nothing
Else
WshShell.Run "OUTLOOK.EXE /importprf
\\biezegroep.net\sysvol\BIEZEGROEP.NET\scripts\Neptunus\Inlog\NPoutlook.prf"
,True
On Error Resume Next
End If
What i want is:
When a user loged in this script look on his documents and settings
folder if the "outlook.txt" file exist.
If this file exist then there is nothing to do...
if this file NOT exist then must the outlook profile be installed...
and there must be created a "outlook.txt" in the documents and settings
file %username%
Can you help?
Thanks
.
- Prev by Date: How to use Sleep and DoEvents in HTA application?
- Next by Date: Comparison Script Components with Script Classes
- Previous by thread: How to use Sleep and DoEvents in HTA application?
- Next by thread: Comparison Script Components with Script Classes
- Index(es):
Relevant Pages
|