Search This Blog

Tuesday, October 19, 2010

Getting the Machine Name through the Script

The below piece of code will give you the machine name and the user name of the pc where it is running. This is particularly useful when we need system parameters:

Set oWshNetwork = CreateObject("WScript.Network")
sMachine = oWshNetwork.ComputerName
sUser = oWshNetwork.UserName
msgbox sMachine
msgbox sUser
You can get all other system params also using similar codes using WScript.Network

No comments:

Post a Comment