Sign in to follow this  
Followers 0
jefhal

compmgmt.msc takes remote computer name from command line

4 posts in this topic

#1 ·  Posted (edited)

I was bored so I converted the command line program compmgmt.msc into one that can take a machine name as a parameter. Compile this as, e.g. +compmgmt.exe and then use it as: +compmgmt sysname

It will open the management console and then switch to the machine you want to view. I'm going through all the *.msc files to do the same (where applicable.)

if $CmdLine[0] = "" Then
    $SysName = InputBox("Enter System Name", "Please enter system name","localhost")
Else
    $SysName = $CmdLine[1] 
EndIf
Run("mmc c:\windows\system32\compmgmt.msc /computer:\\" & $SysName)
Exit

Updated per Mikeqf

Here's the event viewer converted to accept command line input of the remote system name. By the way, these work great as task shell commands in a custom Active Directory console. You just use the system "Name" as the parameter and you are "good to go".

if $CmdLine[0] = "" Then
    $Sysname = InputBox("Enter System Name", "Please enter system name","localhost")
Else
    $SysName = $CmdLine[1] 
EndIf
run(@comspec & ' /c ' & "eventvwr.msc",@tempdir,@SW_HIDE)
winwait("Event Viewer")
send("!ac")
winwait("Select Computer")
send($SysName)
send("{enter}")
Exit
Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites



nice, now all you need is to put them all together with an option on which one you want to run ;)

Share this post


Link to post
Share on other sites

FYI, a quicker way to run compmgmt.msc on a remote computer:

Func _CompMgmt()
     $PCName = InputBox("PC Name","Enter the PC Name")
     Run("mmc c:\windows\system32\compmgmt.msc /computer:\\" & $PCName)
EndFunc

Share this post


Link to post
Share on other sites

nice, now all you need is to put them all together with an option on which one you want to run ;)

Of course! Even when I run these from my Active Directory task bar, once I have the machine name, a popup gui would be useful...

FYI, a quicker way to run compmgmt.msc on a remote computer:

Thanks! Do you think I could find that yesterday on Google? No. I knew there were switches, but could NOT find them. By the way the code at the top of my script is so I can run the same script from command line or from the Active Directory task bar. I point to a machine and launch whatever tool I need on that target machine: Dameware, Compmgmt, c$, CreateNameScript, Find1394, LastUser, EventManager... The lazy man's path to more time on the AutoIT forum!

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0