Blog

Author Archive

Adobe Reader X – An internal error occurred.

Adobe Reader X - An internal error occurred.
We had Adobe Reader X on a Windows Server 2012 Terminal server all of a sudden coming up with ‘An internal error occurred.’
After Some research Found that Disabling the Adobe Reader X sandbox protection resolved the error.
More about the feature can be found here – http://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/Privileged.html#idkeyname_1_10186

Here is the registry fix to make the changes.

1
2
3
4
Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\Acrobat Reader\11.0\FeatureLockDown]
"bProtectedMode"=dword:00000000

Posted in: Technical

Leave a Comment (2) →

GFI Max Automatically restart service

Here is how to set the GFI Max service to restart on failure.

1
2
SC failure "Advanced Monitoring Agent" reset=86400  actions= restart/300/restart/300/run/300
SC failure "Advanced Monitoring Agent" command= "AgentFailed.bat"

Create a batch file called AgentFailed.bat and put whatever you want it to do on the 3rd fail.
Some ideas would be to make it restart, send a message to the user to call the helpdesk, or use something like blat to send an email notifying you.

Posted in: Blog, Scripts, Technical

Leave a Comment (0) →

Howto brand MAV 6.2

Capture

Hey Guys,

Since the introduction of MAV 6.2 they have taken away the ability for us to brand MAV.
Here is a workaround I came up with as so many people have requested it.

Please note that this modifies the resources of the files. Although changes no actual code, don’t expect it to be supported by GFI.
Another words, do this at your own risk!

First step, Install MAV on a development computer.
Then download and install Resource hacker from http://www.angusj.com/resourcehacker/
Download and extract these files onto your local drive. MAV Branding Script
Finally, go into the C:\Program Files\Advanced Monitoring Agent\managedav and copy SBRES_MAX_en-US.dll into the DLL directory in the MAV Branding\DLL folder
Go into the New directory and edit the files to your liking. Make sure to keep them in the same format and size.
Run the Branding.bat and it will generate a new DLL file
Stop the MAV service and replace the DLL file with the one generated.
Start the service back up again, log off and back on again so the tray process is restarted also.

Once you’ve tested, just replace the DLL file on your customers computers and the next time they restart you should have your branding.

Posted in: Scripts, Technical

Leave a Comment (0) →

TeamViewer Linux Integration (.tvc)

Here is a little tip on how to get .tvc files associated with TeamViewer under Linux (Debian/Ubuntu).

So install TeamViewer 8 If you haven’t already.

1
2
3
cd /tmp
wget http://download.teamviewer.com/download/teamviewer_linux.deb
dpkg -i teamviewer_linux.deb

Now to create the association.

1
nano ~/.local/share/applications/takecontrol.desktop

Paste in the following

1
2
3
4
5
6
7
8
9
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Take Control
Comment=TeamViewer Remote Control Application
Exec=teamviewer --desktop --control %f
Icon=/opt/teamviewer8/tv_bin/desktop/teamviewer.png
Type=Application
Categories=Network;

Press Ctrl + O to save changes then Ctrl + X to quit
Find your .tvc file and open with Take Control
Then all files from then on should open directly with team

Posted in: Blog, Scripts, Technical

Leave a Comment (4) →

mscorsvw.exe high CPU useage

After some .NET updates you may find mscorsvw.exe using up a lot of your CPU.
David goes into more detail why this happens on his blog here – http://blogs.msdn.com/b/davidnotario/archive/2005/04/27/412838.aspx

But here is my copy and paste solution.
Let this complete and mscorsvw.exe should go away!

1
2
3
4
5
6
7
cd /d "C:\Windows\Microsoft.NET\Framework\v4.0.30319"
ngen.exe executequeueditems
 
if %PROCESSOR_ARCHITECTURE%==AMD64 (
  cd /d "C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
  ngen.exe executequeueditems
)

Posted in: Blog, Scripts

Leave a Comment (0) →

Varnishlog Error – _.vsm: No such file or directory

# /usr/bin/varnishlog
Cannot open /usr/local/var/varnish/test-varnish/_.vsm: No such file or directory

If you get this error chances are you have both a source and packaged based install.
remove both of them.

1
yum remove varnish

Then go into your source directory

1
make uninstall

Then re-install varnish again from the repo

1
yum install varnish

Posted in: Blog, Technical

Leave a Comment (0) →

Install Varnish 3.0 with VSF (Varnish Security Firewall) on centos 6

Just finished setting up our cluster of varnish servers and its working nicely.
Using lsyncd to replicate the varnish configs, but thats for another post.

Here is a step by step on howto install varnish with VSF (Varnish Security Firewall) on centos 6.
If have already installed varnish then be sure to uninstall it before completing the steps below.

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
sed -i 's/SELINUX=.*/SELINUX=permissive/' /etc/sysconfig/selinux
setenforce 0
 
yum groupinstall "Development Tools" -y
yum install docutils pcre-devel gcc* git nano -y
 
cd /tmp
wget http://repo.varnish-cache.org/source/varnish-3.0.3.tar.gz
tar xf varnish-3.0.3.tar.gz && cd varnish-3.0.3 && ./configure
make -j3 && make install
cd -
 
git clone https://github.com/comotion/VSF.git
cd VSF/
 
git clone https://github.com/fastly/libvmod-urlcode.git
git clone https://github.com/nand2/libvmod-throttle.git
git clone https://github.com/xcir/libvmod-parsereq.git
git clone https://github.com/varnish/libvmod-shield.git
 
for mod in parsereq urlcode shield throttle; do
   cd libvmod-$mod
   ./autogen.sh && VARNISHSRC=/tmp/varnish-3.0.3 VMODDIR=/usr/lib64/varnish/vmods ./configure && make -j3
   make install
   cd -
done
 
cd /tmp/varnish-3.0.3 
make uninstall
 
rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm
yum install varnish -y
chkconfig varnish on
 
mv /tmp/VSF/ /usr/share/
cd /etc/varnish && ln -s /usr/share/VSF/vcl security
 
nano /etc/varnish/default.vcl

Now add:
include “/etc/varnish/security/vsf.vcl”;
edit /etc/sysconfig/varnish to change the listen port to 80

reboot and you should be good to go!

Posted in: Scripts

Leave a Comment (3) →

CleanupStartup

Here again with another script, this time to clean-up what runs on a computer.
Can kill off start-up entries, services and tasks.
Tasks only works from vista and above as I don’t have a XP machine to play around on.

Anyways, just add to the array the names of the programs you want removed.
Here are a few ive found but be sure to let me know which ones you add to the list so I can keep it updated.

Thanks! 🙂

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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
Dim RemoveStartups, RemoveTasks, DisableServices, objWMIService, WshShell
Set WshShell = CreateObject("WScript.Shell")
 
'Change your programs here
RemoveStartups = Array("Dell Registration","Adobe Reader Speed Launcher","SunJavaUpdateScged","Switchboard","AdobeCS6ServiceManager","AdobeCS5ServiceManager","AdobeCS4ServiceManager","AdobeAAMUpdater-1.0","AdobeARM","UpdReg","RoxWatchTray","Desktop Disc Tool","ATICustomerCare","QuickTime Task","iTunesHelper","Google Update","IAStorIcon")
RemoveTasks = Array("AdobeAAMUpdater-1.0","GoogleUpdateTaskUser", "Adobe Flash Player Updater")
DisableServices = Array("AdobeARMservice","AdobeFlashPlayerUpdateSvc","SwitchBoard")
 
'Dont Modify Below this

For Each Item in RemoveStartups
	DeleteStartup(Item)
Next
 
WScript.Echo " "
 
For Each Item in RemoveTasks
	DeleteScheduledTask(Item)
Next
 
WScript.Echo " "
 
For Each Item in DisableServices
	DisableService(Item)
Next
 
WScript.Echo " "
 
ShowStartupItems()
WScript.Echo " "
ShowScheduledTasks()
 
Sub DisableService(strName)
	strComputer = "."
	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
	Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = '" & strName & "'")
 
	For Each objService in colServiceList
		If objService.State = "Running" Then
			objService.StopService()
			Wscript.Sleep 5000
		End If
		errReturnCode = objService.ChangeStartMode("Disabled")   
		WScript.Echo "Disabled Service: " & strName
	Next
End Sub
 
Sub DeleteStartup(strName)
	If KeyExists(strKey & strName) Then 
		WshShell.RegDelete strKey & strName
		WScript.Echo "Removing Startup: " & strName
	End If
 
	If KeyExists(strKey64 & strName) Then 
		WshShell.RegDelete strKey64 & strName
		WScript.Echo "Removing Startup: " & strName
	End If
End Sub
 
Sub DeleteScheduledTask(strName)
' Create the TaskService object.
Set service = CreateObject("Schedule.Service")
call service.Connect()
 
' Get the task folder that contains the tasks. 
Dim rootFolder
Set rootFolder = service.GetFolder("\")
 
Dim taskCollection
Set taskCollection = rootFolder.GetTasks(0)
 
    Dim registeredTask
 
    For Each registeredTask In taskCollection
		If instr(registeredTask.Name, strName) <> 0 then
			rootFolder.DeleteTask registeredTask.Name, 0 
			WScript.Echo "Deleted Task: " & registeredTask.Name
		End If
    Next
End Sub
 
Function KeyExists(strKey)
	On Error Resume Next 
	WshShell.RegRead(strKey)
	bFound = (err.number = 0) 
	On Error Goto 0 
 
	If bFound then
		KeyExists = True
	Else
		KeyExists = False
	End if
End Function
 
Sub ShowStartupItems()
	'------------------------------------------------------------------------------- 
	'Display startup program list. 
	'By: Umesh C. Thakur (ucthakur@hotmail.com) 
	'------------------------------------------------------------------------------- 
	dim strKey, strComputer, oReg, strKeyValue 
	const HKEY_LOCAL_MACHINE = &H80000002 
	strKey="SOFTWARE\Microsoft\Windows\CurrentVersion\Run" 
	strComputer = "." 
 
	Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") 
	oReg.EnumValues HKEY_LOCAL_MACHINE, strKey,arrValueNames 
 
	'List header 
	wscript.echo "PROGRAM NAME" & vbTab & vbTab & "PROGRAM PATH" 
	wscript.echo "------------" & vbTab & vbTab & "---------------------------------" 
 
	'Loop through all programs, display their name and path. 
	For i = 0 To UBound(arrValueNames) 
		oReg.GetStringValue HKEY_LOCAL_MACHINE, strKey, arrValueNames(i), strKeyValue 
		wscript.echo arrValueNames(i) & vbTab & vbTab & strKeyValue 
	Next 
End Sub
 
Sub ShowScheduledTasks()
	WScript.Echo "Registed Tasks"
	WScript.Echo "-----------------"
	' Create the TaskService object.
	Set service = CreateObject("Schedule.Service")
	call service.Connect()
 
	' Get the task folder that contains the tasks. 
	Dim rootFolder
	Set rootFolder = service.GetFolder("\")
 
	Dim taskCollection
	Set taskCollection = rootFolder.GetTasks(0)
 
	Dim numberOfTasks
	numberOfTasks = taskCollection.Count
 
	If numberOfTasks = 0 Then 
		Wscript.Echo "No tasks are registered."
	Else
 
		Dim registeredTask
		For Each registeredTask In taskCollection
			WScript.Echo "Task Name: " & registeredTask.Name
		Next
	End If
End Sub

Posted in: Scripts

Leave a Comment (6) →

Cleanup Site Concentrator

Hey Guys,

I’ve had a number of site concentrators not clearing the cache properly.
According to http://www.allthingsmax.com/2011/12/saving-time-headaches-by-saving.html,

The Site Concentrator is self-cleaning, so in 30 days or less after download, the patches, etc. will be removed from the cache path automatically.

I have not found this to be the case, so have had to write a script to do it for me.
Paremeters to be passed are:
/ConcentratorPath: for where the cache Directory is located.
/ReportOnly: if you want to see how many files are over 30 days without deleting them.

Parameter Example:
/ConcentratorPath:”c:\UpdateCache” /ReportOnly:true

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
Option Explicit  
Dim FSO, Folder, File, DateRange, CurrentFolder, TotalSize, FileSize, Path, bDebug, ReportOnly
 
Set FSO = CreateObject("Scripting.FileSystemObject") 
 
Path = WScript.Arguments.Named("ConcentratorPath")
ReportOnly = WScript.Arguments.Named("ReportOnly")
 
If FSO.FolderExists(Path) = false Then
	WScript.echo "Concentrator Path not found."
	WScript.Quit(1)
End If
 
If lcase(ReportOnly) = "true" Then 
	bDebug = true
	if bDebug = true Then WScript.echo "*** No Files Deleted, ReportOnly Enabled ***"
End If 
 
DateRange = dateadd("d", -30, Now)
ProcessDirectory(Path) 
 
If TotalSize = 0 then
	WScript.echo "No Old Updates Found."
ElseIf TotalSize > 1024 then
	TotalSize = TotalSize / 1024
	WScript.echo "Total Size: " & FormatNumber(int(TotalSize * 100) / 100, 2) & "Gb"
Else
	WScript.echo "Total Size: " & FormatNumber(int(TotalSize * 100) / 100, 2) & "Mb"
End If
 
if bDebug = true Then WScript.echo "*** No Files Deleted, ReportOnly Enabled ***"
WScript.Quit(0)
 
Sub ProcessDirectory(Directory)
Set CurrentFolder = FSO.GetFolder(Directory) 
 
For Each File in CurrentFolder.Files
	If File.DateLastModified < DateRange then
		FileSize = File.Size / 1024 / 1024
		WScript.Echo File.Name & " last modified at " & File.DateLastModified
		WScript.Echo "File Size: " & FormatNumber(int(FileSize * 100) / 100, 2) & "Mb"
 
		If bDebug = false Then 
			On Error Resume Next 'Dirty Error Handleing :)
			File.Delete
			On Error goto 0
		End if
 
		TotalSize = TotalSize + FileSize
	End if
Next
 
For Each Folder in CurrentFolder.Subfolders
	ProcessDirectory(Directory & Folder.Name)
Next
 
End Sub

Posted in: Scripts

Leave a Comment (0) →

PatchMyPC Script

I wrote this a little while ago, but for some reason I forgot to post it.
Here it is 🙂

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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
'------------------------------------------------------------------------------ 
' PathMyPC.vbs 
'------------------------------------------------------------------------------ 
' Script that will update software. 
'------------------------------------------------------------------------------
'Usage: PathMyPC.vbs /EnableWU:<True/False> /AllCommon:<True/False>
' 
'   EnableWU: This switch will run Windows updates automatically after third party updates
'   AllCommon: This switch will install all the programs in the common list that aren't installed unless the program is marked as skipped.
' 
' ex: PathMyPC.vbs /EnableWU:True /AllCommon:False
'
'------------------------------------------------------------------------------ 
' Author: Jake Paternoster
' Created: 12/04/2013 (Info@Screwloose.com.au)
'------------------------------------------------------------------------------ 

Dim WshShell, oExec, OsType, FSO, strFolder, AgentPath, strURL, strKey
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
 
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
strURL = "http://patchmypc.net/PatchMyPC.exe"
strParameters = "/s"
 
EnableWU = WScript.Arguments.Named("EnableWU")
 
If lcase(EnableWU) = "true" Then 
	strParameters = strParameters & " /update"
End If 
 
AllCommon = WScript.Arguments.Named("AllCommon")
 
If lcase(AllCommon) = "true" Then 
	strParameters = strParameters & " /applyallcommon"
End If 
 
 If OsType = "x86" then
     AgentPath = "C:\Program Files\"
 ElseIf OsType = "AMD64" then
     AgentPath = "C:\Program Files (x86)\"
 End If
 
 If FSO.FolderExists(AgentPath & "Advanced Monitoring Agent") Then
     AgentPath = AgentPath & "Advanced Monitoring Agent"
 ElseIf FSO.FolderExists(AgentPath & "Advanced Monitoring Agent GP") Then
     AgentPath = AgentPath & "Advanced Monitoring Agent GP"
 Else
     wscript.Echo "Agent Folder Not Found."
	 wscript.exit(2000)
 End If
 
strFolder = AgentPath & "\PatchMyPC"
 
 If Not FSO.FolderExists(strFolder) Then
	WScript.Echo "Creating Folders..."
	FSO.CreateFolder strFolder
	FSO.CreateFolder strFolder & "\Logs"
End If
 
If Not FSO.FileExists(strFolder & "\PatchMyPC.exe") Then
	WScript.Echo "Downloading PatchMyPC..."
	HTTPDownload strURL, strFolder & "\PatchMyPC.exe"
End If
 
WScript.Echo "Setting Registry Values"
 
strKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Patch My PC"
WshShell.RegWrite strKey & "\PATH", strFolder, "REG_SZ"
WshShell.RegWrite strKey & "\Options\AutoUpdatePatchMyPC", "1", "REG_SZ"
WshShell.RegWrite strKey & "\Options\KillPrograms", "1", "REG_SZ"
WshShell.RegWrite strKey & "\Options\MinimizeToTrayUpdates", "1", "REG_SZ"
WshShell.RegWrite strKey & "\Options\MRemoveIcons", "1", "REG_SZ"
WshShell.RegWrite strKey & "\Options\RestorePoint", "1", "REG_SZ"
WshShell.RegWrite strKey & "\Options\LogSaveLocation", strFolder & "\Logs", "REG_SZ"
 
WScript.Echo "Running PatchMyPC..."
 
ret = WshShell.Run(chr(34) & strFolder & "\PatchMyPC.exe" & chr(34) & " " & strParameters, 1, true)
 
If ret = 0 then
	WScript.Echo "PatchMyPC completed Successfully"
Else
	WScript.Echo "PatchMyPC Encountered and error!"
End If
 
'Wait 2 seconds to make sure the log file is written.
WScript.Sleep 2000
 
WScript.Echo ""
WScript.Echo "PatchMyPC Results:"
WScript.Echo "=================================="
Set folder = FSO.GetFolder(strFolder & "\Logs")
Set files = folder.Files
 
For Each logs In files
	Set objFile = FSO.OpenTextFile(strFolder & "\Logs\" & logs.Name, 1)
 
	Do Until objFile.atEndOfStream 
        WScript.Echo objFile.readLine
	Loop   
 
	objFile.Close
 
	FSO.DeleteFile(strFolder & "\Logs\" & logs.Name)
Next
 
Sub usage 
 '------------------------------------------------------------------------------ 
 WScript.Echo "Usage: PathMyPC.vbs /EnableWU:<True/False> /AllCommon:<True/False>"
 WScript.Echo " "
 WScript.Echo "EnableWU: This switch will run Windows updates automatically after third party updates"
 WScript.Echo "AllCommon: This switch will install all the programs in the common list that aren't installed unless the program is marked as skipped."
 WScript.Echo ""
 WScript.Echo "ex: PathMyPC.vbs /EnableWU:True /AllCommon:False"
 
 WScript.Quit(1) 
End Sub 
 
Sub HTTPDownload(myURL, strFile)
 
 Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
 
 objXMLHTTP.open "GET", myURL, false
 objXMLHTTP.send()
 
 If objXMLHTTP.Status = 200 Then
 Set objADOStream = CreateObject("ADODB.Stream")
 objADOStream.Open
 objADOStream.Type = 1 'adTypeBinary

 objADOStream.Write objXMLHTTP.ResponseBody
 objADOStream.Position = 0 'Set the stream position to the start

 objADOStream.SaveToFile strFile
 objADOStream.Close
 Set objADOStream = Nothing
 End if
 
 Set objXMLHTTP = Nothing
End Sub

Posted in: Scripts

Leave a Comment (3) →
Page 1 of 4 1234