Cannot connect to VPN

2008-06-19 databasemind

Windows XP SP2, Symantec AV (enterprise), Cisco VPN client 4.6

I got call from user:

I cannot connect to the VPN. When I try to connect, I receive the following message…

Error 51: IPC failed with error -4h. This is most likely due to the Cisco System Inc. VPN Service not being started. Please start this service and try again.

Resolution:

Found that it is conflict issue between AV and VPN client.

If “Enable File System Real Time Protection” was unchecked (disabled), user had no problems launching VPN client.

Uninstalled AV.
Uninstalled VPN.

Reinstalled AV.
Reinstalled VPN.

Also did the following on the computer.

sfc /scannow
chkdsk /f
defrag C: /a
regestry cleaning

One or more activex controls could not be displayed in Outlook

2008-03-28 databasemind

Windows XP SP, Outlook 2003

User was getting error message “One or more activex controls could not be displayed…”.

It is 2 ways to resolve this issue.

1) Check checkbox for “Use Microsoft Office Word 2003 to edit messages” in Outlook’s Tool >> Options >> Mail Format

2)If you don’t want to use Word.

Go to

C:\Documents and Settings\user_name\Application Data\Microsoft\Signatures

Make sure you make a copy of the *.htm signature.

Open htm signature in notepad.

Search for tag <object>.

Delete everything between <object></object> tags, including tags.

Save document. The problem is solved.

Additional resources:

Microsoft Outlook 2003
Microsoft Outlook 2007



System error. Your computer was affected by unknown trojan

2008-03-27 databasemind

OS Windows XP SP2.

Got call from user who was getting “system error your computer was affected by unknown trojan” error every time he would open IE browser or Windows Explorer.

User had Symantec AV running also Windows Defender.

I also had to install SpyBot and Adaware and run it.

I did scan for viruses and spyware.Everything seems to be OK, but this error would not go away.

Solution that worked for me was removing registry entry.

Please, make sure you have backup of this registry entry first.

Removing every key in the following registry key. 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects.

Do not delete “Browser Helper Objects” key.

Please be careful working with a registry, because you can make your computer not operational and would require reload OS. 

Extract Job History From SQL Server

2008-02-19 databasemind

Tested on SQL Server 2000 and 2005

SELECT sj.job_id,
    job_name = sj.name,
    status = CASE sjh.run_status WHEN 0 THEN ‘Failed’ WHEN 1 THEN ‘Succeeded’ WHEN 3 THEN ‘Canceled’ WHEN 4 THEN ‘In-progress message’ END,
    sjh.message,
    sjh.run_date,
    sjh.run_time,
    sjh.run_duration,
    CASE sjh.run_date WHEN 0 THEN NULL ELSE
    convert(datetime,
            stuff(stuff(cast(sjh.run_date as nchar(8)), 7, 0, ‘-’), 5, 0, ‘-’) + N’ ‘ +
            stuff(stuff(substring(cast(1000000 + sjh.run_time as nchar(7)), 2, 6), 5, 0, ‘:’), 3, 0, ‘:’),
            120) END AS [StartTime],
     DATEADD(second,sjh.run_duration,
     CASE sjh.run_date WHEN 0 THEN NULL ELSE
     convert(datetime,
             stuff(stuff(cast(sjh.run_date as nchar(8)), 7, 0, ‘-’), 5, 0, ‘-’) + N’ ‘ +
             stuff(stuff(substring(cast(1000000 + sjh.run_time as nchar(7)), 2, 6), 5, 0, ‘:’), 3, 0, ‘:’),
             120) END)AS [EndTime],
    sjh.server FROM msdb.dbo.sysjobhistory sjh
    LEFT OUTER JOIN msdb.dbo.sysoperators so1  ON
(sjh.operator_id_emailed = so1.id)
    LEFT OUTER JOIN msdb.dbo.sysoperators so2  ON
(sjh.operator_id_netsent = so2.id)
    LEFT OUTER JOIN msdb.dbo.sysoperators so3  ON
(sjh.operator_id_paged = so3.id),
    msdb.dbo.sysjobs_view sj
WHERE sjh.step_id = 0

MSI Switches

2008-01-19 databasemind

Switch  Parameters                                Description
————————————————————————–
/i      Package|ProductCode                       Installs or configures a
                                                  product.

/f      [p|o|e|d|c|a|u|m|s|v]Package|ProductCode  Repairs a product.

                                                  p – Reinstalls a
                                                  product only if a
                                                  file is missing.

                                                  o – Reinstalls a
                                                  product if a file
                                                  is missing or if an
                                                  older version of a file
                                                  is installed.

                                                  e – Reinstalls a
                                                  product if a file
                                                  is missing or an equal
                                                  or older version of a
                                                  file is installed.

                                                  d – Reinstalls a
                                                  product if a file
                                                  is missing or a
                                                  different
                                                  version of a file is
                                                  installed.

                                                  c – Reinstalls a
                                                  product if a file
                                                  is missing or the stored
                                                  checksum value does not
                                                  match the calculated
                                                  value.

                                                  a – Forces all files to
                                                  be reinstalled.

                                                  u – Rewrites all
                                                  required user-
                                                  specific registry
                                                  entries.

                                                  m – Rewrites all
                                                  required
                                                  computer-specific
                                                  registry entries.

                                                  s – Overwrites all
                                                  existing shortcuts.

                                                  v – Runs from the source
                                                  file and re-caches the
                                                  local package.

/a   Package                                      Administrative
                                                  installation option.
                                                  Installs a product on
                                                  the network.

/x   Package|ProductCode                          Uninstalls a product.

/j   [u|m]Package                                 Advertises a product.
     or [u|m]Package /t Transform List            The property values used
     or[u|m]Package /g LanguageID                 on the command line are
                                                  ignored.

                                                  u – Advertises a product
                                                  to the current user.

                                                  m – Advertises a product
                                                  to all users.

                                                  g – Language ID.

                                                  t – Applies a transform
                                                  list to an advertised
                                                  package.

/l      [i|w|e|a|r|u|c|m|p|v|+|!]Logfile          Specifies the log
                                                  file path and
                                                  indicates the flags
                                                  to be logged.

                                                  i – Status messages.

                                                  w – Non-fatal warnings.

                                                  e – All error messages.

                                                  a – Startup of actions.

                                                  r – Action-specific
                                                  records

                                                  u – User requests.

                                                  c – Initial User
                                                  Interface (UI)
                                                  parameters

                                                  m – Out-of-memory.

                                                  p – Terminal properties.

                                                  v – Verbose output.

                                                  + – Appends to the
                                                  existing file.

                                                  ! – Clears each line in
                                                  the log file.

                                                  “*” – Wildcard.
                                                  Logs all information,
                                                  but the use of the v
                                                  option is not included.
                                                  To include the v option,
                                                  type “/l*v.”

/p   Patch/Package                                Applies a patch. To
                                                  apply a patch to an
                                                  installed Administrator
                                                  image, type the
                                                  following options:

                                                  /p [PatchPackage]
                                                  /a [Package]

/q   n|b|r|f                                      Sets the UI level.

                                                  q , qn – No UI.

                                                  qb – Basic UI.

                                                  qr – Reduced UI. A modal
                                                  dialog box is displayed
                                                  at the end of the
                                                  installation.

                                                  qf – Full UI. A modal
                                                  dialog box is displayed
                                                  at the end of the
                                                  installation.

                                                  qn+ – No UI. However, a
                                                  modal dialog box is
                                                  displayed at the end of
                                                  the installation.

                                                  qb+ – Basic UI. A modal
                                                  dialog box is displayed
                                                  at the end of the
                                                  installation. If you
                                                  cancel the installation,
                                                  a modal dialog box is
                                                  not displayed.

                                                  qb- – Basic UI with no
                                                  modal dialog boxes.
                                                  The “/qb+-” switch
                                                  is not a supported UI
                                                  level.

/y   module                                       Calls the system
                                                  Application Programming
                                                  Interface (API)
                                                  DllRegisterServer, which
                                                  registers modules that
                                                  are typed on the
                                                  command line (for
                                                  example, “msiexec /y
                                                  my_file.dll”).

                                                  This option is only used
                                                  for registry information
                                                  that cannot be added
                                                  using the registry
                                                  tables of the .msi file.

/z   module                                       Calls the system API
                                                  DllUnRegisterServer,
                                                  to unregister modules
                                                  that are typed on the
                                                  command line (for
                                                  example, “msiexec /z
                                                  my_file.dll”).

                                                  This option is only used
                                                  for registry information
                                                  that cannot be removed
                                                  using the registry
                                                  tables of the .msi file.

Outlook journal stopped recording

2008-01-08 databasemind

Platform: WIndows XP SP2, Outlook 2003 on Exchange 2003.Got complaint from a user that outlook journal stopped recording office documents.Ran SCANPST.EXE utility in C:\Program Files\Common Files\System\MSMAPI\1033 to check and fix errors in .pst for Inbox.Then Tools -> Options -> Journal Options and did uncheck all files in [Also record files from] and checked [E-Mail Message] under  [Automatically record these items].

Closed Outlook. Opened Outlook again.

In Journal Options I did check all files in [Also record files from] .

Closed Outlook. Opened Outlook again Created MS Word file and MS Excel file and saved it.

Now I was able to see files in Outlook Journal.

I don’t know what was a reason for this problem.

I’m also not clear on why it took steps described above to fix the problem…. but it did work for me.

  

Get current working directory in bat file

2008-01-02 databasemind

echo %CD% would display current working directory in cmd prompt.

Defrag with reboot – batch file

2007-12-16 databasemind

Platform tested:

Windows XP and 2003 

cd %windir%\system32
defrag C: -f
shutdown.exe -s -t 5

Replace text in set of files in folder – VB Script

2007-12-16 databasemind

‘this script is created by Roman Feldblum 

set fso = CreateObject(“Scripting.FileSystemObject”)
 ’set shell = CreateObject(“Wscript.Shell”)
 ’ shell.Exec “cscript //h:cscript //s”
 ’set shell=nothing

if WScript.Arguments.count = 3 then

 if fso.FolderExists (WScript.Arguments(0)) then
 ’WScript.Arguments(0)
  set folder = fso.GetFolder(WScript.Arguments(0))
 
  for each file in folder.files
   set stream = fso.OpenTextFile (WScript.Arguments(0) & “\” & file.name,1)
   if not stream.AtEndOfStream then
    text = “”
    text = stream.ReadAll
    set stream = nothing
    if err.number = 0 then
     text = Replace(text,WScript.Arguments(1),WScript.Arguments(2))
     set stream = fso.OpenTextFile (WScript.Arguments(0) & “\” & file.name,2)
     ’Wscript.Echo fso.GetExtensionName(WScript.Arguments(0) & “\” & file.name)
      if err.number = 0 then
       stream.Write text
      end if
     stream.close
     set stream = nothing
    end if
   else
    set stream = nothing
   end if
  next
  Wscript.Echo “DONE”
 else
  WScript.Echo (“Folder:” & WScript.Arguments(0) & ” does not exists…”)
  WScript.Echo (“The usage is:” & vbcrlf & “ReplaceString.vbs arg1 arg2 arg3 arg4(optional)” & vbcrlf _
   & ” where:” & vbcrlf & “arg1 = folder path (C:\MyFolder)” & vbcrlf _
   & “arg2 = string to be replaced” & vbcrlf _
   & “arg3 = string to replace with” & vbcrlf _
   & “arg4 = file extension (optional)”)
 end if
‘******************************************************************************************
elseif WScript.Arguments.count = 4 then

 if fso.FolderExists (WScript.Arguments(0)) then
 ’WScript.Arguments(0)
  set folder = fso.GetFolder(WScript.Arguments(0))
 
  for each file in folder.files
   if lcase(fso.GetExtensionName(WScript.Arguments(0) & “\” & file.name)) = lcase(WScript.Arguments(3)) then
    set stream = fso.OpenTextFile (WScript.Arguments(0) & “\” & file.name,1)
    if not stream.AtEndOfStream then
     text = “”
     text = stream.ReadAll
     set stream = nothing
     if err.number = 0 then
      text = Replace(text,WScript.Arguments(1),WScript.Arguments(2))
      set stream = fso.OpenTextFile (WScript.Arguments(0) & “\” & file.name,2)
      ’Wscript.Echo fso.GetExtensionName(WScript.Arguments(0) & “\” & file.name)
       if err.number = 0 then
        stream.Write text
       end if
      stream.close
      set stream = nothing
     end if
    else
     set stream = nothing
    end if
   end if
  next
  Wscript.Echo “DONE”
 else
  WScript.Echo (“Folder:” & WScript.Arguments(0) & ” does not exists…”)
  WScript.Echo (“The usage is:” & vbcrlf & “ReplaceString.vbs arg1 arg2 arg3 arg4(optional)” & vbcrlf _
   & ” where:” & vbcrlf & “arg1 = folder path (C:\MyFolder)” & vbcrlf _
   & “arg2 = string to be replaced” & vbcrlf _
   & “arg3 = string to replace with” & vbcrlf _
   & “arg4 = file extension (optional)”)
 end if
‘******************************************************************************************
else
 WScript.Echo (“The usage is:” & vbcrlf & “ReplaceString.vbs arg1 arg2 arg3 arg4(optional)” & vbcrlf _
  & ” where:” & vbcrlf & “arg1 = folder path (C:\MyFolder)” & vbcrlf _
  & “arg2 = string to be replaced” & vbcrlf _
  & “arg3 = string to replace with” & vbcrlf _
  & “arg4 = file extension (optional)”)
end if

set fso = nothing
 

List Processes – VB Script

2007-12-16 databasemind

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)
Set colListOfServices = objWMIService.ExecQuery _
    (“Select * from Win32_Service”)
For Each objService in colListOfServices
    If objService.PathName = “C:\WINDOWS\system32\services.exe” Then
        Wscript.Echo objService.DisplayName
    End If
Next