process command line arguments in WSH script

Working with Command-Line Arguments
Microsoft® Windows® 2000 Scripting Guide
How to pass arguments with VBScript
This sample script shows how to process command line arguments using Windows Scripting Host. The example below would be used such that you would save this code off into args.vbs file. Open a command line .
Type in args.vbs argument1 argument2 etc... just put spaces between your arguments.

Set ArgObj = WScript.Arguments
sArgCount = ArgObj.Count
For x = 0 to sArgCount - 1
  msgbox ArgObj(x)
set ArgObj = Nothing

Test script that shows how many arguments you've typed
Option Explicit

Dim vArg, aArgs(), iCount, args
If WScript.Arguments.Count = 0 Then
  WScript.Echo "No Arguments Supplied"
  args = WScript.Arguments.Count
  WScript.Echo "You entered " & args & " Arguments:"
  ReDim aArgs(wscript.Arguments.Count - 1)
  For iCount = 0 To WScript.Arguments.Count - 1
    aArgs(iCount) = WScript.Arguments(iCount)
    WScript.Echo aArgs(iCount)
End If

Save above codes to args.vbs and run it like below:
csript   args.vbs  arg1  agr2  agr3 

Advance arguments passing skills
This article shows you how to make DOS like switches with your VBScript
dir /ad /b

doublespace /mount c:
Further reading:



Active mode FTP VS passive mode FTP


FTP is a TCP based service exclusively. There is no UDP component to FTP.
There are two ways to communication with FTP and that is: active and passive.
FTP is an unusual service in that it utilizes two ports, a 'data' port and a 'command' port (also known as the control port). Traditionally these are port 21 for the command port and port 20 for the data port. The confusion begins however, when we find that depending on the mode, the data port is not always on port 20.

How does Active FTP work?
In active mode FTP the client connects from a random unprivileged port (poer number > 1023) to the FTP server's command port, port 21. Then, the client starts listening to port N+1 and sends the FTP command PORT N+1 to the FTP server. The server will then connect back to the client's specified data port from its local data port, which is port 20.
Firewall on Active FTP - what ports should be opened on server and client side?
On server port 20 and port 21 must be opened on the client (home user) ports higher than 1023 must be opened for successfull ftp connection and transfer of files.

How does Passive FTP work?

In passive mode FTP the client initiates both connections to the server, solving the problem of firewalls filtering the incoming data port connection to the client from the server.
When opening an FTP connection, the client opens two random unprivileged ports locally (port number > 1023 and port number+1). The first port contacts the server on port 21, but instead of then issuing a PORT command and allowing the server to connect back to its data port, the client will issue the PASV command.
The result of this is that the server then opens a random unprivileged port (P > 1023) and sends the PORT P command back to the client. The client then initiates the connection from port (port number+1) to port (port number) on the server to transfer data.
The passive FTP protocol is very good because a lot of connections on internet are over ADSL, cable... and clients use routers to connect to the internet. Routers usualy filter data so active ftp protocol can not be used. This problem is solved with active file transfer protocol.
Firewall on Passive FTP - what ports should be opened on server and client side?
On server port 21 and ports (port number > 1023) must be opened. On client side no change is needed.

How To Configure PassivePortRange In IIS

Configuring FTP Site Properties (IIS 6.0)

port triggering VS port forwarding

difference between port triggering and port forwarding

FTP has nothing to do with port triggering and everything to do with a statically forwarded port. Its the algorithm in the router that handles the random upper level ports that are used by the server software. Initial negotiation is done by a user outside on the WAN who can access the server because port 21 is forwarded (an open door if you will). Then the software authenticates the user (name/password, however you have set it up) and then starts to manage the request, which means opening up data ports for the actual transfer, the router handles all of this properly so that the outgoing is sent to the originator etc....)
Port triggering is different in that its designed to allow dynamic port forwarding An outgoing request by a user ON THE LAN, tells the router (by means of the port being used on the outgoing request) to open or forward a port or range of ports for a limited period of time, so that incoming traffic on different ports (those opened) can get through the router NAT and to the sender.
In order to use the same service on a different LAN computer, you have to manually replace the LAN computer's IP address in the forwarding port with another LAN computer's IP address.
Trigger port forwarding solves this problem by allowing computers on the LAN to dynamically take turns using the service. The router records the IP address of a LAN computer that sends traffic to the WAN to request a service with a specific port number and protocol (a "trigger" port). When the router's WAN port receives a response with a specific port number and protocol ("incoming" port or port range as designated by the end user), the router forwards the traffic to the LAN IP address of the computer that sent the request. After that computer's connection for that service closes, another computer on the LAN can use the service in the same manner. This way you do not need to configure a new IP address each time you want a different LAN computer to use the application.
For example:
Jane requests a file from the Real Audio server (port 7070).
Port 7070 is a "trigger" port and causes the router to record Jane's computer IP address.The router associates Jane's computer IP address with the "incoming" port range of 6970-7170 because that what has been set up in the port triggering menu!!
The Real Audio server responds to Janes request and uses the expected port or ports ranging between 6970-7170.The ZyWALL forwards the traffic to Jane's computer IP address.Only Jane can connect to the Real Audio server until the connection is closed or times out. The router times out depending on the brand in use, both UDP and TCP. Should be configurable or at least known.
Port forwarding (static) is the process of opening a door in the router, by the user, so that an outside person/entity can access a PC or server behind the router.The door is always open and requires no action by the users on the LAN.
Port triggering is based on an OUTGOING request by a user on the LAN. It allows dynamic port forwarding to temporarily occur, so that the user can access services (REAL AUDIO) or gaming etc..... It assists the users behind the PC. A method of sharing a port or port forwarding range.
FTP algorithm is port negotiation between the FTP software and the router. Initial communication is done by an outside (WAN side) PC/user, using the open door/port 21. A standard port forwarding case.The FTP program then selects random ports and communicates that with the WAN side user. The router firmware detects which ports are being used and ensures that traffic from the WAN user reaches the FTP server, on the high numbered ports.This traffic is normally uploading by the WAN User and thus the ports need to be open so that the return packets (Ack) which communicate progress of the upload can reach the FTP server. The other traffic would be in the case of downloading data to the server by the WAN side user.
It is not triggering of a set range of identified ports, its a negotiation of randomly assigned ports between the router and FTP software.


command line to check remote session and kill

command line to check remote session:

qwinsta /server:servername

rwinsta sessionname [session id] /server:servername


Explanation of Regsvr32 usage and error messages


Troubleshooting Program Deployment By Using Verbose Logging

Troubleshooting Program Deployment By Using Verbose Logging

When a program that is deployed through Group Policy is not installed correctly on a client computer, a log file can be generated that records the steps of the Group Policy Application Deployment component leading up to the unsuccessful installation. This information, in conjunction with logging from the Windows Installer service, can be very helpful in determining the cause of the problem.

To enable verbose logging of Application Deployment operations, add the following registry value on the client computer. Delete this value after troubleshooting to avoid performance degradation:
Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Diagnostics

Note that the you may need to create the Diagnostics key.

Value: AppMgmtDebugLevel
Data: 4b
The logging file is named Appmgmt.log and is located in the %SystemRoot%\Debug\Usermode folder on the client computer.



Microsoft FTP site

Looking for those legacy tools for win98, win2000, IIS4, NT4? Try this site:


How to delete and recreate the user profile on the local computer (Vista)

How to delete and recreate the user profile on the local computer (Vista)

1. restart the computer and logon with an administrator account.
2. Rename (or delete) the existing user profile folder: "c:\users\xxxxx"
3.Open Registry Editor (regedit.exe)
4. First, export to backup the registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
5. Then, expand the ProfileList and delete the key which the Data of ProfileImagePath is “C:\users\xxxxxx”
6. Log off and try to logon with the problematic account.