I don’t know if you know, but there is a command line interface (CLI) for WMI and it’s called WMIC! It’s pretty powerful stuff. You don’t need to write VB scripts for theese tasks, just do it in the command line. As usual when such stuff is available from the command line readability suffers (at least I think so).
Wmic installes it self the first time you try to run it. You can either write ”wmic” in the prompt and get warped into it’s own prompt.
C:\\> wmic wmic:root\\cli>
Or you can run it from the dos-prompt just writing ”wmic” first in every command (nice for batch files and such). So, a simple example:
wmic:root\\cli> COMPUTERSYSTEM Get Name Name COMPNAME
That is not very advanced is it, so let’s try renaming our computer.
wmic:root\\cli> COMPUTERSYSTEM CALL Rename NEWNAME, Password, User
Should be that simple, but that returns a parameter error. After a quite a lot of trial and error I figured it out.
wmic:root\\cli> COMPUTERSYSTEM where ”Name=’COMPNAME'” CALL Rename NEWNAME, Password, User
And a reboot to finish it of!
Tags: Computing