Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

World cup college
Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2010-03-03 - Commandlinefu @ SXSW 2010
Am going to be at SXSW this year, in case you want to submit any CLI nuggets or suggestions to me in person. Ping me on the @codeinthehole Twitter account.
2009-09-12 - Email updates now available
You can now enable email updates to let you know each time you're command is commented on.
2009-07-11 - API and javascript blog widget now available
A simple API has been released, allowing commands to be retrieved in various formats. This also allows commands to be embedded on blogs/homepages.
2009-05-17 - Added duplicate suggestions to the new command form
When adding a new command, a quick background search is performed to make sure you're not duplicating a command already in the system.
Hide

Tags

Hide

Functions

Activate Remote Desktop REMOTELY!!!

Terminal - Activate Remote Desktop REMOTELY!!!
wmic /node:"RemoteServer" /user:"domain\AdminUser" /password:"password" RDToggle where servername="RemoteServer" call SetAllowTSConnections 1
2010-01-25 18:55:05
User: vlan7
4
Activate Remote Desktop REMOTELY!!!

Have you ever wanted to connect to a win machine with Remote Desktop disabled?

You can activate the permission remotely and then connect to your remote server with the magic wmic.

Know a better way?

If you can do better, submit your command here.

What others think

When would this not work? What needs to be enabled on the Windows System for this to work?

Comment by freethinker 6 weeks and 2 days ago

This is useful when the remote windows system has Remote Desktop disabled by Group Policy.

See http://support.microsoft.com/kb/306300 for further details.

If you administer a remote machine with Remote Desktop disabled and you need to access it remotely you can re-enable it remotely with the wmic command I've provided.

You don't want to travel to the place where the remote machine is to activate Remote Desktop locally right? ;)

Of course, you need admin privileges... you must be the network administrator...

Best regards,

Comment by vlan7 6 weeks and 2 days ago

What this package is "wmic" ??

I have this message in my Ubuntu

No command 'wmic' found, did you mean:

Command 'wmc' from package 'wine' (universe)

Command 'wmc' from package 'wine1.2' (universe)

Command 'wmix' from package 'wmix' (universe)

Command 'wmii' from package 'wmii' (universe)

Command 'wmii' from package 'wmii2' (universe)

Command 'rmic' from package 'openjdk-6-jdk' (main)

Command 'rmic' from package 'kaffe' (universe)

Command 'rmic' from package 'gcj-4.3' (universe)

Command 'rmic' from package 'gcj-4.4-jdk' (main)

Command 'rmic' from package 'sun-java6-jdk' (multiverse)

Command 'wmlc' from package 'wap-wml-tools' (multiverse)

wmic: command not found

Comment by krot4u 6 weeks and 2 days ago

wmic is a windows command.

There's a port for linux called wmi-client

On your Ubuntu maybe you can install it with this syntax:

sudo apt-get install wmi-client

Regards,

Comment by vlan7 6 weeks and 2 days ago

not working in Ubuntu

Because:

Usage: [-?|--help] [--usage] [-d|--debuglevel DEBUGLEVEL] [--debug-stderr]

[-s|--configfile CONFIGFILE] [--option=name=value]

[-l|--log-basename LOGFILEBASE] [--leak-report] [--leak-report-full]

[-R|--name-resolve NAME-RESOLVE-ORDER]

[-O|--socket-options SOCKETOPTIONS] [-n|--netbiosname NETBIOSNAME]

[-W|--workgroup WORKGROUP] [--realm=REALM] [-i|--scope SCOPE]

[-m|--maxprotocol MAXPROTOCOL] [-U|--user [DOMAIN\]USERNAME[%PASSWORD]]

[-N|--no-pass] [--password=STRING] [-A|--authentication-file FILE]

[-S|--signing on|off|required] [-P|--machine-pass]

[--simple-bind-dn=STRING] [-k|--kerberos STRING]

[--use-security-mechanisms=STRING] [-V|--version] [--namespace=STRING]

//host query

Example: wmic -U [domain/]adminuser%password //host "select * from Win32_ComputerSystem"

Comment by krot4u 6 weeks and 2 days ago

What command have you introduced?

You may be careful about the slash and backslash...

Comment by vlan7 6 weeks and 2 days ago

Alternatively you could use the psexec port for *nix called winexe and do somethin' like this:

winexe -U HOME/Administrator%Pass123 //host 'reg add reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0'
Comment by vlan7 6 weeks and 2 days ago

# wmic

-bash: wmic: command not found

Comment by ozymandias 6 weeks and 2 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts