Difference between revisions of "WPKG over VPN"
From WPKG | Open Source Software Deployment and Distribution
m |
m |
||
Line 1: | Line 1: | ||
I have configured all computers to have GPO startup script to run this script. This scripts calls '''wpkg-start.bat''' only if a computer is present on local subnet (C class) and doesn't have an IP belonging to VPN IP pool. I'm running a small OpenVPN client set. All updates to this script or the whole concept are welcome! | I have configured all computers to have GPO startup script to run this script. This scripts calls '''wpkg-start.bat''' only if a computer is present on local subnet (C class) and doesn't have an IP belonging to VPN IP pool. I'm running a small OpenVPN client set. All updates to this script or the whole concept are welcome! | ||
+ | =Changes= | ||
+ | *VPN VBs script now called within batch file (keeps main WPKG shell window hidden) | ||
+ | |||
+ | ==check-vpn.vbs== | ||
<source lang="vb"> | <source lang="vb"> | ||
On Error Resume Next | On Error Resume Next | ||
Line 9: | Line 13: | ||
Subnet="192.168.10." | Subnet="192.168.10." | ||
IPStart=245 | IPStart=245 | ||
− | IPEnd= | + | IPEnd=254 |
− | + | ||
− | + | ||
For Each adapter in colItems | For Each adapter in colItems | ||
Line 24: | Line 26: | ||
if Host >= IPStart and Host <= IPEnd then | if Host >= IPStart and Host <= IPEnd then | ||
− | 'VPN connection | + | 'NO-WPKG: VPN connection present |
− | Wscript.Quit | + | Wscript.Quit 0 |
else | else | ||
− | + | 'START-WPKG: local network present | |
+ | Wscript.Quit 1 | ||
end if | end if | ||
end if | end if | ||
Line 34: | Line 37: | ||
Next | Next | ||
− | ' | + | 'NO-WPKG: local network not present |
− | + | </source> | |
− | + | ==wpkg-start-vpn-bat== | |
− | + | <source lang="vb"> | |
+ | cls | ||
+ | |||
+ | :: This is a recommended way of starting WPKG. | ||
+ | |||
+ | |||
+ | |||
+ | :: Use WPKGROOT variable to define where wpkg.js script is. | ||
+ | |||
+ | |||
+ | |||
+ | :: Use PACKAGES variable to define where all your software/installers are. | ||
+ | |||
+ | :: You can later use the PACKAGES variable (and all other variables) in your xml files. | ||
+ | |||
+ | |||
+ | set WPKGROOT=\\tpsrv05\wpkg$ | ||
+ | |||
+ | set SOFTWARE=%WPKGROOT%\content | ||
+ | |||
+ | |||
+ | cscript %WPKGROOT%\check-vpn.vbs | ||
+ | |||
+ | if ERRORLEVEL 0 GOTO END | ||
+ | |||
+ | |||
+ | %WPKGROOT%\wpkg.js /synchronize /quiet /nonotify | ||
− | + | :END | |
− | + | ||
− | + | ||
− | + | ||
</source> | </source> | ||
[[Category: Documentation]] | [[Category: Documentation]] |
Revision as of 11:10, 12 January 2009
I have configured all computers to have GPO startup script to run this script. This scripts calls wpkg-start.bat only if a computer is present on local subnet (C class) and doesn't have an IP belonging to VPN IP pool. I'm running a small OpenVPN client set. All updates to this script or the whole concept are welcome!
Changes
- VPN VBs script now called within batch file (keeps main WPKG shell window hidden)
check-vpn.vbs
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True",,48)
Subnet="192.168.10."
IPStart=245
IPEnd=254
For Each adapter in colItems
If Not IsNull(adapter.IPAddress) Then
For i = 0 To UBound(adapter.IPAddress)
IP = CStr(adapter.IPAddress(i))
Host = CStr(Trim(Replace(IP, Subnet, "")))
Dots = InStr(Host, ".")
if Dots = 0 then
Host = CInt(Host)
if Host >= IPStart and Host <= IPEnd then
'NO-WPKG: VPN connection present
Wscript.Quit 0
else
'START-WPKG: local network present
Wscript.Quit 1
end if
end if
Next
end if
Next
'NO-WPKG: local network not present
wpkg-start-vpn-bat
cls
:: This is a recommended way of starting WPKG.
:: Use WPKGROOT variable to define where wpkg.js script is.
:: Use PACKAGES variable to define where all your software/installers are.
:: You can later use the PACKAGES variable (and all other variables) in your xml files.
set WPKGROOT=\\tpsrv05\wpkg$
set SOFTWARE=%WPKGROOT%\content
cscript %WPKGROOT%\check-vpn.vbs
if ERRORLEVEL 0 GOTO END
%WPKGROOT%\wpkg.js /synchronize /quiet /nonotify
:END