Showing posts with label Scripts. Show all posts
Showing posts with label Scripts. Show all posts

Saturday, December 20, 2008

Create Instant System Restore Point

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

'Unattended System Restore Point
'sysrestorepoint.vbs
'© Doug Knox - rev 02/11/2002
'Downloaded from www.dougknox.com
'Extracted from original code by Bill James - www.billsway.com

Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")

msg = "New Restore Point successfully created." & vbCR
msg = msg & "It is listed as: " & vbCR
msg = msg & "Automatic Restore Point " & Date & " " & Time

'Put a ' in front of the next five lines to disable the Success Failed Prompt.
If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox msg
Else
MsgBox "Restore Point creation Failed!"
End If

'Remove the ' from the next 3 lines to only alert you if the process failed
'If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) <> 0 Then
' MsgBox "Restore Point creation Failed!"
'End If

USB2 Test

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

On Error Resume Next
'The presence of the following key seems to indicate USB 2
RegKey = "HKLM\SYSTEM\CurrentControlSet\Enum\USB\ROOT_HUB20"

'Attempt to read the key
CreateObject("WScript.Shell").RegRead(RegKey & "\")

If Err Then
'An error is always returned when there is no default value, so
'check for specific error message returned for missing key
If InStr(LCase(Err.Description), "invalid root") > 0 Then
MsgBox "This computer does not seem to be USB 2 enabled."
Else
MsgBox "This computer appears to be USB 2 enabled."
End If
End If

Show Network Icon When Connected

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

On Error Resume Next

set ws = WScript.CreateObject("WScript.Shell")

start = "HKLM\SYSTEM\CurrentControlSet"

classGUID = ws.RegRead(start & "\Enum\Root\MS_NDISWANIP\0000\ClassGUID")
netID = ws.RegRead(start & "\Control\Class\" & classGUID & "\0000\NetCfgInstanceID")

ws.RegWrite start & "\Control\Network\" & classGUID & "\" & netID & "\Connection\ShowIcon", 1, "REG_DWORD"

MsgBox "Show icon in Notification Area when connected is set.", 4096,"Finished"

Enable / Disable Recent Documents History

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

'docshist.vbs - Disables/Enables Recent Docs History
'© Doug Knox - rev 12/17/99

Option Explicit

'Declare variables
Dim WSHShell, n, MyBox, p, p1, p2, t, mustboot, errnum, vers
Dim enab, disab, jobfunc, itemtype

Set WSHShell = WScript.CreateObject("WScript.Shell")
p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\"
p = p & "NoRecentDocsHistory"
itemtype = "REG_DWORD"
mustboot = "Log off and back on, or restart your pc to" & vbCR & "effect the changes"
enab = "ENABLED"
disab = "DISABLED"
jobfunc = "Recent Docs History is now "

'This section tries to read the registry key value. If not present an
'error is generated. Normal error return should be 0 if value is
'present
t = "Confirmation"
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (p)
On Error Goto 0
errnum = Err.Number

if errnum <> 0 then
'Create the registry key value for NoRecentDocsHistory with value 0
WSHShell.RegWrite p, 0, itemtype
End If

'If the key is present, or was created, it is toggled
'Confirmations can be disabled by commenting out
'the two MyBox lines below

If n = 0 Then
n = 1
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & disab & vbCR & mustboot, 4096, t)
ElseIf n = 1 then
n = 0
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & enab & vbCR & mustboot, 4096, t)
End If

Disable Media Player's Recent Files List

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

'mediaplayer_mru_off.vbs - Prevents additions to the Recent Files List
'© Doug Knox - revised 03/16/2002
'This code may be freely distributed/modified
'Downloaded from www.dougknox.com

Option Explicit
On Error Resume Next
Dim p1, p2, p3, WshShell, MyBox

p1 = "HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences\AddToMRU"
p2 = 00
p3 = "HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Player\RecentFileList\"

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegWrite p1, p2, "REG_BINARY"
WshShell.RegDelete p3

Set WshShell = Nothing

MyBox = MsgBox("Media Player's Recent File list is Disabled", 4096, "Finished")

Disable / Enable Internet & Folder Options

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

'Downloaded from www.dougknox.com
'Fix Internet Options Restrictions
'© Doug Knox - rev 05/21/2003

Option Explicit

'Declare variables
Dim WSHShell, n, MyBox, p, p1, p2, itemtype
itemtype = "REG_DWORD"

Set WSHShell = WScript.CreateObject("WScript.Shell")

p = "HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Restrictions\NoBrowserOptions"
p1 = "HKEY_USERS\.DEFAULT\Software\Policies\Microsoft\Internet Explorer\Restrictions\NoBrowserOptions"
p2 = "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Internet Explorer\Restrictions\NoBrowserOptions"

'Create/modify the registry key value for NoBrowserOptions with value 0
WSHShell.RegWrite p, 0, itemtype
WSHShell.RegWrite p1, 0, itemtype
WSHShell.RegWrite p2, 0, itemtype

p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoFolderOptions"
p1 = "HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoFolderOptions"
p2 = "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoFolderOptions"

'Create/modify the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite p, 0, itemtype
WSHShell.RegWrite p1, 0, itemtype
WSHShell.RegWrite p2, 0, itemtype

MsgBox "Done. You may need to log off/log on or reboot for the change to take effect.",4096,"Finished!"

Clears Search History in Windows XP

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

'xp_clear_search.vbs - Clears Search History in Windows XP
'© Doug Knox - revised 04/15/2002
'This code may be freely distributed/modified
'Downloaded from www.dougknox.com

Option Explicit
On Error Resume Next
Dim p1, p2, p3, WshShell, MyBox

p1 ="HKEY_CURRENT_USER\Software\Microsoft\Search Assistant\ACMru\5001\"
p2 = "HKEY_CURRENT_USER\Software\Microsoft\Search Assistant\ACMru\5603\"
p3 = "HKEY_CURRENT_USER\Software\Microsoft\Search Assistant\ACMru\5604\"

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegDelete p1
WshShell.RegDelete p2
WshShell.RegDelete p3

Set WshShell = Nothing

'Un-comment the next line to make the confirmation dialog appear
'MyBox = MsgBox("Search History has been cleared.", 4096, "Finished")

Change Owner & Organization details in computer

---open Notepad > type & save the below lines with a filename xxx.vbs & run it----

'ChgOwnOrg.vbs - Change Win9x Registered Owner/Organization.
'© Bill James - billjames.geo@yahoo.com - rev 29 Oct 1999.
'Modified for Windows XP

Option Explicit

Set ws = WScript.CreateObject("WScript.Shell")
Dim ws, t, p1, p2, n, g, cn, cg
Dim itemtype

p1 = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\"

n = ws.RegRead(p1 & "RegisteredOwner")
g = ws.RegRead(p1 & "RegisteredOrganization")
t = "Change Owner and Organization Utility"
cn = InputBox("Type new Owner and click OK", t, n)
If cn <> "" Then
ws.RegWrite p1 & "RegisteredOwner", cn
End If

cg = InputBox("Type new Organization and click OK.", t, g)
If cg <> "" Then
ws.RegWrite p1 & "RegisteredOrganization", cg
End If

Lock Desktop Instantly

Right click on desktop > new > shortcut > %windir%\system32\rundll32.exe user32.dll,LockWorkStation
> save name as Windows Lock

Friday, December 19, 2008

Description of Svchost.exe in Windows XP

Each instance of svchost.exe process seen in the Task Manager hosts a group of services. To see the list of services hosted by each instance of svchost.exe.
*
Click Start > Run > CMD.EXE
*
Type tasklist /svc >c:\taskList.txt

The taskList.txt will contain the list of Processes, their Process IDs and the Services running under each Process.