Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Sunday, May 18, 2014

VBScript to change the proxy settings if disconnected from VPN

When connected to VPN, user's IE proxy settings get changed and is forced by VPN.
Often the users might get disconnected from VPN while working from home and this does not revert back the proxy settings to the original one.
I have written a VBScript to change the proxy settings of the users. This script can be made a shortcut and then used.

'Script Created by Piyush Nasa
'Script to change Proxy settings for user if disconnected from VPN

Option Explicit
Dim valUserIn
Dim objShell, RegLocate, RegLocate1
Set objShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
valUserIn = MsgBox("If you have been disconnected from VPN and want to reset your proxy, click Yes and restart Internet Explorer",4,"Proxy Reset")
If valUserIn=vbYes Then
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
objShell.RegWrite RegLocate,"","REG_SZ"
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
objShell.RegWrite RegLocate,"0","REG_DWORD"

'Enable AutoDetect in the proxy by calling this sub
IEautomaticallydetect

MsgBox "Proxy is reset to AutoDetect"

else
'I do not want any proxy so I have disabled this, but if you want to set a proxy then you can use this.

'RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
'objShell.RegWrite RegLocate,"xxxx.xxx.com:80","REG_SZ"
'RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
'objShell.RegWrite RegLocate,"1","REG_DWORD"
MsgBox "Your Proxy is not changed."
End If
WScript.Quit



 SUB IEautomaticallydetect


 DIM sKey,sValue,binaryVal
 Dim oReg
 Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")    'For registry operations througout

 Const HKCU=&H80000001

 sKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
 sValue = "DefaultConnectionSettings"

 oReg.GetBinaryValue HKCU, sKey, sValue, binaryVal

'you can keep different values of this binary to have different options. 9 is just for Auto detect enable.
binaryVal(8) = 9

 oReg.SetBinaryValue HKCU, sKey, sValue, binaryVal
 end sub

Thursday, December 08, 2011

App-V for Royalblue Fidessa application

I want to document the OSD file for Royalblue Fidessa Application here as other capture done alone does not make the virtualized package work. There were certain client customizations which were required and I had to do them in the OSD file.
Here is the OSD file which I used:


<?xml version="1.0" standalone="no"?>

<SOFTPKG GUID="XXXX-XXX-XXXX-XXXX" NAME="Fidessa" VERSION="6.3.9.61056">

<IMPLEMENTATION>

<CODEBASE HREF="FILE://%SFT_SOFTGRIDSERVER%\SCCMData\Royalblue_Fidessa_6.7.0b_VFS_v1.0\Royalblue_Fidessa_6.7.0b_VFS_v1.0.sft" GUID="8XXX5-8XX0-4XX7-AXX1-5171XXXXXA0" PARAMETERS="" FILENAME="%CSIDL_PROGRAM_FILES%\royalblue\fidessa\FtwLaunch.exe" SYSGUARDFILE="Royalblue_Fidessa_6.7.0b_VFS_v1.0\osguard.cp" SIZE="15076089"/>

<VIRTUALENV TERMINATECHILDREN="FALSE">

<POLICIES>

<LOCAL_INTERACTION_ALLOWED>TRUE</LOCAL_INTERACTION_ALLOWED>

</POLICIES>

<REGISTRY>

<REGKEY HIVE="HKLM" KEY="Software\royalblue technologies\Fidessa" NOREDIR="FALSE">

<REGVALUE NAME="ReadWritePath" REGTYPE="REG_SZ">C:\ProgramData\Fidessa\Fidessa</REGVALUE>

</REGKEY>

</REGISTRY>

<ENVLIST/>

</VIRTUALENV>

<WORKINGDIR/>

<VM VALUE="Win32">

<SUBSYSTEM VALUE="windows"/>

</VM>

<OS VALUE="Win2003TS"/>

<OS VALUE="Win2003TS64"/>

<OS VALUE="Win2008R2TS64"/>

<OS VALUE="Win2008TS"/>

<OS VALUE="Win2008TS64"/>

<OS VALUE="Win7"/>

<OS VALUE="Win764"/>

<OS VALUE="WinXP"/>

<OS VALUE="WinXP64"/>

</IMPLEMENTATION>

<DEPENDENCY>

<CLIENTVERSION VERSION="4.6.0.0"/>

<SCRIPT EVENT="LAUNCH" PROTECT="FALSE" TIMING="PRE" WAIT="TRUE" EXTERN="TRUE">

<SCRIPTBODY LANGUAGE="Batch">ECHO OFF \n IF NOT EXIST "C:\ProgramData\Fidessa" MD "C:\ProgramData\Fidessa" \n IF NOT EXIST "C:\ProgramData\Fidessa\Fidessa" MD "C:\ProgramData\Fidessa\Fidessa" \n IF NOT EXIST "C:\ProgramData\Fidessa\Fidessa\install" MD "C:\ProgramData\Fidessa\Fidessa\install" \n IF NOT EXIST "C:\ProgramData\Fidessa\Fidessa\log" MD "C:\ProgramData\Fidessa\Fidessa\log" \n IF NOT EXIST "C:\ProgramData\Fidessa\Fidessa\install\USER.config" cmd.exe /c Echo Y
cacls "C:\ProgramData\Fidessa\Fidessa" /t /e /c /g Users:C \n</SCRIPTBODY>

</SCRIPT>

</DEPENDENCY>

<PACKAGE NAME="Royalblue_Fidessa_6.7.0b_VFS_v1.0"/>

<ABSTRACT>App-V 4.6 SP1</ABSTRACT>

<MGMT_SHORTCUTLIST>

<SHORTCUT LOCATION="%CSIDL_PROGRAMS%\Fidessa\Fidessa" FILENAME="Fidessa.lnk" OVERRIDDEN="TRUE" DISPLAY="Fidessa" ICON="%SFT_MIME_SOURCE%/Royalblue_Fidessa_6.7.0b_VFS_v1.0 Icons/Fidessa 6.3.9.61056.ico"/>


</MGMT_SHORTCUTLIST>

<MGMT_FILEASSOCIATIONS>

<PROGIDLIST/>

<FILEEXTENSIONLIST/>

</MGMT_FILEASSOCIATIONS>

</SOFTPKG>



The Script is the main part and the customization which was required so that the Updates from Fidessa Server are downloaded in local ProgramData directory rather than in bubble. Then this should be able to update the directory inside the bubble, hence made local interaction true. The Directory inside bubble was given write permission. Also all references to C:\ProgramData were deleted in the bubble so that the files are automatically downloaded to the local machine.