3,217
edits
Changes
m
Created page with '<source lang="xml"> <package id="WpkgMultiSite" name="WpkgMultiSite" revision="0" priority="10000" execute="once"> <install cmd='cscript \\10.31.31.31\export$\…'
<source lang="xml">
<package id="WpkgMultiSite"
name="WpkgMultiSite"
revision="0"
priority="10000"
execute="once">
<install cmd='cscript \\10.31.31.31\export$\wpkg\WpkgMultiSite.vbs' />
</package>
</source>
== WpkgMultiSite.vbs ==
<source lang="vb">
' Wpkg multi site
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
set WshShell = CreateObject("WScript.Shell")
set oEnv=WshShell.Environment("System")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
'WScript.Echo IPConfig.IPAddress(i)
mTab = Split(IPConfig.IPAddress(i), ".")
prefix = mTab(0) & "." & mTab(1)
Select Case prefix
'site 1 québec
Case "10.31"
oEnv("SOFTWARE") = "\\10.31.31.31\export$\wpkg"
'site 2 torento
Case "10.40"
oEnv("SOFTWARE") = "\\10.40.40.40\export$\wpkg"
'site 3 montréal
Case "10.41"
oEnv("SOFTWARE") = "\\10.41.41.41\export$\wpkg"
' par default
Case "else"
oEnv("SOFTWARE") = "\\10.31.31.31\export$\wpkg"
End Select
Next
End If
Next
'wscript.echo "Wpkg %SOFTWARE%: " & WshShell.Environment.item("SOFTWARE")
</source>
[[Category:Documentation]]
<package id="WpkgMultiSite"
name="WpkgMultiSite"
revision="0"
priority="10000"
execute="once">
<install cmd='cscript \\10.31.31.31\export$\wpkg\WpkgMultiSite.vbs' />
</package>
</source>
== WpkgMultiSite.vbs ==
<source lang="vb">
' Wpkg multi site
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
set WshShell = CreateObject("WScript.Shell")
set oEnv=WshShell.Environment("System")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
'WScript.Echo IPConfig.IPAddress(i)
mTab = Split(IPConfig.IPAddress(i), ".")
prefix = mTab(0) & "." & mTab(1)
Select Case prefix
'site 1 québec
Case "10.31"
oEnv("SOFTWARE") = "\\10.31.31.31\export$\wpkg"
'site 2 torento
Case "10.40"
oEnv("SOFTWARE") = "\\10.40.40.40\export$\wpkg"
'site 3 montréal
Case "10.41"
oEnv("SOFTWARE") = "\\10.41.41.41\export$\wpkg"
' par default
Case "else"
oEnv("SOFTWARE") = "\\10.31.31.31\export$\wpkg"
End Select
Next
End If
Next
'wscript.echo "Wpkg %SOFTWARE%: " & WshShell.Environment.item("SOFTWARE")
</source>
[[Category:Documentation]]