No network is without its fun, especially a network with Windows computers. Here is some stuff you can try:
Access to the Command Prompt
Works on: Windows 2000/XP/2003/Vista
If you want to access the command prompt, but it is disabled, you can access the interpreter as long as batch files are still enabled. Just use this script and save it with a CMD or BAT extension.
@echo off
:subMain
echo Enter command
set /p inCommand=
if "%inCommand%"=="exit" exit
%inCommand%
echo.
goto subMain
This script is a batch file, or rather more accurately a Windows NT command script (as we are running it on Windows NT5 and above and it uses some Windows NT5+ syntax). The
@echo off turns
off command echoing in the script, which makes it look neater.
:subMain is not a command, but a marker which allows us to return to later on (using
gotoecho Enter command is a command to
merely print the words Enter command on the screen, and
set /p inCommand= simply prompts for data to put into the inCommand variable. if "%inCommand%"=="exit" exit statement basically asks if
the inCommand variable equals exit then exit the script. %inCommand% then gets the command processor to try and process the data in the inCommand variable, and echo. merely makes a space for
cosmetic reasons, and goto subMain gets the processor to return to the :subMain to repeat the whole process.
Shutting down a remote computer
Works on: Windows 2000/XP/2003/Vista
To shut down a computer use the following VBscript. Just copy and paste it into notepad and save it with a VBS extension.
strComputer = "jimmyspc"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(1)
Next
Make sure you change the strComputer = "jimmyspc" to the host name of the target computer, e.g. strComputer = "Clairescomputer"
Restarting a remote computer
Works on: Windows 2000/XP/2003/Vista
To restart a computer use the following VBscript. Just copy and paste it into notepad and save it with a VBS extension.
strComputer = "jimmyspc"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
Make sure you change the strComputer = "jimmyspc" to the host name of the target computer, e.g. strComputer = "Clairescomputer"
Listing the user logged on at a remote computer
Works on: Windows 2000/XP/2003/Vista
To list the user logged on at a remote computer use the following VBscript. Just copy and paste it into notepad and save it with a VBS extension.
strComputer = "jimmyspc"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo "Logged-on user: " & objComputer.UserName
Next
Make sure you change the strComputer = "jimmyspc" to the host name of the target computer, e.g. strComputer = "Clairescomputer"
This script is especially useful if you want to know who's computer you are about to shut down.
Stop a process on a remote computer
Works on: Windows 2000/XP/2003/Vista
To stop a process running on a remote computer use the following VBscript. Just copy and paste it into notepad and save it with a VBS extension.
strComputer = "jimmyspc"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'EXPLORER.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Yes, closing a process means any program running on the computer! So, I can now close for example Microsoft Word on someone's computer without any warning, it just disappears instantly.
Make sure you change the strComputer = "jimmyspc" to the host name of the target computer, e.g. strComputer = "Clairescomputer" and make sure you change EXPLORER.EXE to the process you want to close (e.g. Microsoft Word is WINWORD.EXE)
Preventing a process on a remote computer
Works on: Windows 2000/XP/2003/Vista
To prevent a process from running on a remote computer use the following VBscript. Just copy and paste it into notepad and save it with a VBS extension. To stop the prevention you have put in
place, you will need to end the WSCRIPT.EXE process on your computer, or alternatively you can log off and log back on.
strComputer = "jimmyspc"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancecreationevent " _
& " within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.Name = "EXPLORER.EXE" Then
objLatestProcess.TargetInstance.Terminate
End If
Loop
Make sure you change the strComputer = "jimmyspc" to the host name of the target computer, e.g. strComputer = "Clairescomputer" and make sure you change EXPLORER.EXE to the process you want to prevent (e.g. Microsoft Word is WINWORD.EXE)
Sending a message over the network
Works on: Windows NT4/2000/XP/2003
Can send from: Windows WFW 3.11/95/98/Me/NT4/2000/XP/2003
This can be pretty useful to send insulting messages to one user, multiple users or the entire domain (not recommended for obvious reasons). This is where the batch file you made in the 'Access to the command prompt' section will come useful. The Messenger service will need to be running on the target computer for this to work.
To send to a single user from Windows NT4/2000/XP/2003/Vista, type:
net send Bobby Hello world
Replace Bobby with the target username or hostname. Replace Hello world
To send using Windows WFW 3.11/95/98/Me, use WINPOPUP.EXE
Page Comments
Please visit the Forum. Here you may find more information related to the page you are on, and you too can contribute. Sign up now! It won't take a minute
Other Pages