Bonjour,
Je suis nouveau dans le développement, et mon environnement étant Full Windows. Je suis en train de créer des GPO et un Logon script afin d'uniformiser mon parc machine.
J'ai crée plusieurs VBS pour le déploiement de mes applications "socles", Ils fonctionnent parfaitement sur mon site principal.
Je voudrais pouvoir utiliser cela sur un site distant disposant de son propre serveur de sources logicielles.
Il nous arrive de préparer des postes à distance, avec notre compte administrateur. De ce fait, je souhaiterais définir la variable source en fonction de l'adresse IP du poste.
Exemple :
Site A = adresse IP 192.168.1.x = serveur de sources sitea.local
Site B = adresse IP 192.168.2.x = serveur de sources siteb.local
Je suis arrivé à la limite de mes capacités de développement, est il possible d'avoir quelques conseils ?
Voici ce que j'ai commencé à écrire :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 ' ' Localisation des sources ' strComputer = "." Set objWMIService = GetObject("winmgmts:" & "!\\" & strComputer & "\root\cimv2" ) Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True" ) For Each objAdapter in colAdapters IPdebut = LBound(objAdapter.IPAddress) IPfin = UBound(objAdapter.IPAddress) If (objAdapter.IPAddress(IPdebut) <> "" ) then For i = IPdebut To IPfin strIPAddress = objAdapter.IPAddress(i) & vbCrLf Next End If Next Public Function ip2num(IP) 'ipv4-only Dim i, a, N a = Split(ip, ".") N = CDbl(0) For i = 0 To UBound(a) N = N * 256 + a(i) Next ip2num = N End Function If ip2num(strIPAddress) >= ip2num("192.168.0.1")_ And ip2num(strIPAddress) <= ip2num("1192.168.0.254") Then FusionSetupExe = "\\Srv-File\DEPLOY$\fusioninventory\fusioninventory-agent_windows-x64_" & AvailableVersion & ".exe" Elseif ip2num(strIPAddress) >= ip2num("192.168.1.1")_ And ip2num(strIPAddress) <= ip2num("1192.168.1.254") Then FusionSetupExe = "\\Srv-File2\DEPLOY$\fusioninventory\fusioninventory-agent_windows-x64_" & AvailableVersion & ".exe" Else ip2num(strIPAddress) >= ip2num("192.168.3.1")_ And ip2num(strIPAddress) <= ip2num("1192.168.3.254") Then FusionSetupExe = "\\Srv-File3\DEPLOY$\fusioninventory\fusioninventory-agent_windows-x64_" & AvailableVersion & ".exe" End If
Partager