Waarom denk je dat?

Misschien heeft verder niemand er problemen mee om het goed werkend te krijgen?
Anywaus: ik doe het tegenwoordig anders, en gebruik (onder Vista en 7) een scheduled task die @ logon een drivemapping script start, en dat alleen doet als er via een netwerkverbinding met het domain wordt gewerkt.
Eventueel bouw je nog een check in het script in die eerst kijkt met een simpele ping of je server wel reachable is en daarop een switch wel of niet mappen.
iets als dit? garantie tot aan de deur, maar een beetje scripting moet een admin wel kennen toch?
Visual Basic:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| '******************************************************************************
strDriveletter = "P:"
strRemoteShare = "\\server\share"
strServer = "mijnserver"
'******************************************************************************
Set objNetwork = CreateObject("WScript.Network")
Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Navigate "about:blank"
objIE.menubar = False
objIE.toolbar = false
objIE.statusbar = false
objIE.addressbar = false
objIE.resizable = False
objIE.Width=400
objIE.Height = 300
objIE.Left = 100
objIE.Top = 100
objIE.Document.Title = ServerList
objIE.Document.Body.Style.fontFamily = "Arial"
objIE.Document.body.style.fontSize = "10pt"
objIE.Document.body.style.color = "white"
objIE.document.body.style.backgroundColor = "#003388"
objIE.document.body.style.borderStyle = "none"
Set objDoc = objIE.Document.Body
objIE.Visible = 1
'On Error Resume Next
strPingStatus = PingStatus(strServer)
If strPingStatus = "Success" Then
'Wscript.Echo "Success pinging " & strServer
Call Onnet
Else
'Wscript.Echo "Failure pinging " & strServer & ": " & strPingStatus
Call noNet
End If
'******************************************************************************
Function PingStatus(strServer)
On Error Resume Next
strWorkstation = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strWorkstation & "\root\cimv2")
Set colPings = objWMIService.ExecQuery _
("SELECT * FROM Win32_PingStatus WHERE Address = '" & strServer & "'")
For Each objPing in colPings
Select Case objPing.StatusCode
Case 0 PingStatus = "Success"
Case Else PingStatus = "Status code " & objPing.StatusCode & _
" - Unable to determine cause of failure."
End Select
Next
End Function
'******************************************************************************
Sub Onnet
Do While (objIE.Busy)
Wscript.Sleep 1000
Loop
strUser = objNetwork.UserName
strcomputer = objNetwork.computername
objDoc.InnerHTML = "Hello "& strUser & ", Welcome to "& strcomputer & "."
Wscript.Sleep 2000
objDoc.InnerHTML = "Creating network mappings. " _
& "This might take several seconds to complete."
Wscript.Sleep 2000
Set colDrives = objNetwork.EnumNetworkDrives
If colDrives.Count = 0 Then
MapDrives
Else
UnmapDrives
Wscript.Sleep 500
MapDrives
End If
End Sub
'******************************************************************************
Sub UnmapDrives
'MsgBox "Drivemapping delete deel"
objDoc.InnerHTML = "Deleting existing mappings: <br>"
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
objDoc.InnerHTML = objDoc.InnerHTML & "Deleting " & colDrives.Item(i) & "<br>"
WScript.Sleep 1000
objNetwork.RemoveNetworkDrive colDrives.Item(i)
Next
End Sub
'******************************************************************************
Sub MapDrives
objNetwork.MapNetworkDrive strDriveletter, strRemoteShare, strPersist
objDoc.InnerHTML = "Connected " & strRemoteShare & " as drive " & strDriveLetter & "<BR>"
objDoc.InnerHTML = "Network mappings made.<br> Bye!"
Wscript.Sleep 1000
objIE.Quit
End Sub
'****************************************************************************** |
Enzo.
[
Voor 78% gewijzigd door
alt-92 op 20-07-2009 16:15
]