Author Archive | jbmurphy

Installing Flash on CentOS 5.4 x64

Here is what I tried:

wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz

tar -xzf libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz

mv libflashplayer.so ~/.mozilla/plugins/

Visual Studio with VMware Fusion and SSH

I work on a Mac, but by day I am a windows guy. Even though I am not a developer, I often hack about using Visual Studio on the PC. Recently, have been working more and more with Linux, and I wanted to use Visual Studio on my Mac via VMware Fusion to edit some .css files on a linux slice that I have setup. I was looking for extension to Visual Studio to connect to a ssh/sftp site. Then it hit me (things would be a lot easier if I was smarter) – VMware Fusion installed the FUSE file system (optional) on my Mac. I can use the program MacFusion on my Mac to “mount” a ssh FUSE file system, and then add a VMware Fusion “Shared folder” to point to the mounted folder.

Now I can use Visual Studio to edit files on a Linux box!

Detach PSTs

We are looking to get rid of .pst files in our environment and we wanted to remove pst files from peoples machines. This link shows how to prevent adding new psts and how to turn off auto archiving via GPO, but what about existing .psts in peoples Outlook profiles?

I put together this vbscript:

Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objOutlook = CreateObject( "Outlook.Application" )
Set objNamespace =objOutlook.GetNameSpace( "MAPI" )

For i = objOutlook.Session.Folders.Count To 1 Step -1
    strName = objOutlook.Session.Folders.Item(i).Name
    if instr(strName,"Mailbox -") > 0 or strName = "Public Folders" or strName = "SharePoint Lists" or strName = "Microsoft Dynamics CRM" then
       'wscript.echo "not removing:" & objOutlook.Session.Folders.Item(i).Name
    Else
       'wscript.echo "removing:" & objOutlook.Session.Folders.Item(i).Name
       objOutlook.Session.RemoveStore(objOutlook.Session.Folders.Item(i))
    End If
next

Uninstall old Java Version via vbscript

Here is my current script from removing previous versions of java via VBScript

'  FILENAME: UninstallAllOldJava.vbs
'  AUTHOR: jbmurphy
'  SYNOPSIS: This script looks for older versions of Java and removes them
'  DESCRIPTION: Searches add remove programs for J2SE or Java and removes if not current version
'  NOTES: - Must edit strCurrentVersion to match the version you want to keep
'	- if called with a computer name will, run against remote machine
'	- logs to local path defined in strLogPath
'	- assumes admin priv
'  LINKS:
'  EXAMPLE: UninstallAllOldJava.vbs
'  EXAMPLE: UninstallAllOldJava.vbs \\workststion
'  INPUTS: \\workststion (optional)
'  RETURNVALUE: logs to value in strLogPath
'  ChangeLog:
'  	2009-10-27: jbmurphy-changes made

'On Error Resume Next
Option Explicit
DIM objFSO, strComputer, strCurrentVersion, objWMIService, colInstalledVersions
DIM objVersion, strLogPath, strLogName, strExecQuery

IF WScript.Arguments.Count > 0 then
    strComputer = replace(WScript.Arguments(0),"\\","")
ELSE
    strComputer = "."
END If

strLogPath = "%TEMP%"
strLogName = "Java_Uninstall.log"

strCurrentVersion = "Java(TM) 6 Update 15"
strExecQuery = "Select * from Win32_Product Where Name LIKE '%Java 2 Runtime Environment%' OR Name LIKE '%J2SE Runtime Environment%' OR Name LIKE '%Java(TM)%'"
KillProc

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledVersions = objWMIService.ExecQuery (strExecQuery)

LogIt String(120, "_")
LogIt String(120, "¯")
For Each objVersion in colInstalledVersions
    If objVersion.Name = strCurrentVersion then
       LogIt Now() & ": " &replace(strComputer,".","localhost") & ": Current version is installed: " & objVersion.Name & ":" & objVersion.IdentifyingNumber
    else
       LogIt Now() & ": " &replace(strComputer,".","localhost") & ": Uninstalling: " & objVersion.Name  & ":" & objVersion.IdentifyingNumber
       objVersion.Uninstall()
    end if
Next
LogIt String(120, "_")
LogIt String(120, "¯")
LogIt String(120, " ")

Sub LogIt (strLineToWrite)
    'wscript.echo strLineToWrite
    DIM ts
    If Not objFSO.FolderExists(strLogPath) Then MakeDir(strLogPath)
    Set ts = objFSO.OpenTextFile(strLogPath & strLogName, 8, True)
    ts.WriteLine strLineToWrite
    ts.close
End Sub

Function MakeDir (strPath)
	Dim strParentPath
	On Error Resume Next
	strParentPath = objFSO.GetParentFolderName(strPath)

  If Not objFSO.FolderExists(strParentPath) Then MakeDir strParentPath
	If Not objFSO.FolderExists(strPath) Then objFSO.CreateFolder strPath
	On Error Goto 0
  MakeDir = objFSO.FolderExists(strPath)
End Function

Sub KillProc()
   '# kills jusched.exe and jqs.exe if they are running.  These processes will cause the installer to fail.
   Dim wshShell
   Set wshShell = CreateObject("WScript.Shell")
   wshShell.Run "Taskkill /F /IM jusched.exe /T", 0, True
   wshShell.Run "Taskkill /F /IM jqs.exe /T", 0, True
End Sub

Trying to settle on a script documentation header

I want to add a header to all my scripts, keep things organized
This seemed like a good place to start.

VBSCRIPT:

'  FILENAME:
'  AUTHOR:
'  SYMMARY: A summary of what this script does
'  DESCRIPTION: A more in depth description of the script
'  NOTES:
'
'
'  LINKS:
'  EXAMPLE: document a way of calling the script, plus expected output
'  EXAMPLE: example calling the script differently
'  EXAMPLE: rinse and repeat as needed
'  INPUTS: \\servername,yes,log (example)
'  RETURNVALUE: output type
'  ChangeLog:
'  	YYYY-MM-DD: username-changes made

What do you use? Am I missing something?