PerceivedType – Preview Pane in Windows7

No Comments »

I really like the preview pane of win7, it give you a “good size” outlook of what the file you are looking at is about. I definitely updated my system for with the PDF preview handler from

http://timheuer.com/blog/archive/2008/05/09/foxit-pdf-preview-handler.aspx

How about if I could see my script in the preview pane too?? is that a silly idea?? NOOOO!!

Check this out:

http://msdn.microsoft.com/en-us/library/cc144150%28VS.85%29.aspx

All you have to do is add a registry String value under the extension you want (e.g. HKEY_CLASSES_ROOT\.vbs )

Done!

Posted on August 13th 2010 in IT/ Network Admin

vbScript to Obtain IP Address

No Comments »

Being an administrator, you can’t do much if you don’t know about IP Addresses, and how frustrating and stupid it is that it is so difficult to get the IP Address of a machine is a single variable when you are scripting on Windows!!!

sure you can get it with “IPCONFIG” or “ipconfig | find “IP Address”" (winXP) or ipconfig | find “IPv4″ but that gives you a full line and you have to go filter for the ip address only.

Other solutions, vbscript , method, wmi? or registry?

can do both except that the WMI is weird and doesn’t seem to work similarly on winXP as on win7.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration")
 
For Each objItem In colItems
wscript.echo objItem.IPAddress(0)
Next

Gives you the address but an error which doesn’t quite seem to make sense..

the other option, get it from Registry. This is tricky because the network interface subkey is different for every machine. The trick is to recursively search the subkey for the ValueName you are looking for.. et voilà!!

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
    strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces"
retval = objReg.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys)
'WScript.Echo retval
strValueName = "IPAddress"
For Each subkey In arrSubKeys
      strKeyPath1 = strKeyPath & "\" & subkey
	  'wscript.echo strKeyPath
	  Return = objReg.GetMultiStringValue(HKEY_LOCAL_MACHINE,strKeyPath1, _
    strValueName,arrValues)
If (Return = 0) And (Err.Number = 0) Then
' Treat the multistring value as a collection of strings separated by spaces and output
    For Each strValue In arrValues
    WScript.Echo  strValue
Next
End If
 
Next
Posted on August 13th 2010 in IT/ Network Admin

Enable Remote Desktop Remotely

No Comments »

You can also enable remote desktop over the network via regedit if you have administrator rights to the remote machine:

1. Run Regedit
2. Select File –> Connect Network registry
3. Enter the name of the remote computer and select Check Name

At the bottom of the registry tree you will see 2 Hives appear Hkey_Local_Machine and
Hkey_Users (under the remote computer’s name)

4. Goto hklm\system\currentcontrolset\control\terminal server\FdenyTSConnections=1
5. Change the FdenyTSConnections to 0
6. Attempt to Re-Login

To enable remote access to a machine via the command line, type:
psexec \\remotecomputername netsh firewall set service remoteadmin enable
psexec \\remotecomputername netsh firewall set service remotedesktop enable

Posted on July 17th 2009 in IT/ Network Admin

Removing Application from Startup

No Comments »

” RUN > MSCONFIG ” …of course!! But how to really get rid of it from the list ??

There’s where to find them in the registry..

The Registry keys most often involved with startup have the word “Run” in them somewhere. They are listed below using the abbreviation HKLM for the major key (or “hive”) called “HKEY_LOCAL_MACHINE” and HKCU for for the hive “HKEY_CURRENT_USER”

HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices
HKLM\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnceEx

Posted on July 17th 2009 in IT/ Network Admin