Useful command lines to access different parts of Windows Control Panel

Use these commands (.cpl) to gain fast access to different part of the Windows Control Panel:

Action Center                   wscui.cpl
Add/Remove Programs             appwiz.cpl
Date/Time Properties            timedate.cpl
Device Manager                  hdwwiz.cpl
Display Properties              desk.cpl
Fonts Folder                    fonts
Internet Properties             inetcpl.cpl
Game Controller Properties      joy.cpl
Keyboard Properties             main.cpl keyboard
Mouse Properties                main.cpl
Network Properties              ncpa.cpl
Pen and Touch Properties        tabletpc.cpl
People Near Me Properties       collab.cpl
Phone and Modem Properties      telephon.cpl
Power Management                powercfg.cpl
Regional Settings               intl.cpl
Sound Properties                mmsys.cpl
System Properties               sysdm.cpl
Windows Firewall Properties     firewall.cpl

Connect to another database in WordPress using the wpdb class

In WordPress the $wpdb object can talk to any number of tables, but only within database WordPress is installed. In case you need to connect to another database, you will have to instantiate your own object from the wpdb class with the appropriate connection details:

$mydb = new wpdb( 'username' , 'password' , 'database' , 'localhost' );


Once the connection is made you can access the database and its tables as you would in any WordPress database:

$rows = $mydb->get_results("SELECT field1,field2 FROM myTable WHERE field3=1");
foreach ($rows as $row) {
  echo $row->field1;

This code can be in plugins, templates, themes and almost anywhere else inside the WordPress code.

Ubuntu: Switch to Console mode from GUI mode in GNOME

To switch from GUI mode to Console mode in GNOME use these shortcuts


To switch to Console mode:

Press ‘Ctrl + Alt + F1′ (F2 – F6)


To switch between consoles in Console mode

Press ‘Alt + F1′ (F2 – F6)


To switch back to GNOME GUI mode

Press ‘Alt + F7′


Create Event Source with PowerShell

To create a Event Source in PowerShell use this:

$Source = "MyEventSource"
if ([System.Diagnostics.EventLog]::SourceExists($Source) -eq $false {
  [System.Diagnostics.EventLog]::CreateEventSource($Source, "Application")

Get more info on CreateEventSource method here :


In PowerShell 2.0 this is even simpler:

$Source = "MyEventSource"
New-EventLog -LogName Application -Source $Source


Handling attributes with hyphens in PowerShell

Sometimes we need working with PowerShell objects which have attributes with hyphens. That can be a bit difficult as PowerShell assumes hyphens are used with operators and parameters.

Below is an example on how to get around this, and rename the attribute:



$Users = Get-AdUser -Filter * -Property "msDS-ResultantPSO" | Select name, @{Name="ResultantPSO";Expression={$_."msDS-ResultantPSO"}}



Enumerate COM classes using WMI


Quick and short way of enumerating COM classes is using the WMI class Win32_ClassicComClassSetting.



Get-WmiObject win32_ClassicComClassSetting | Select-Object ProgID | Group-Object ProgID | Select-Object Name | Sort-Object Name


Fun with Microsoft Agent and PowerShell

Show Merlin:

$agent = new-object -com Agent.Control.2
$agent.Connected = 1
$merlin = $agent.Characters.Character("Merlin")

List animations:



Activate animation:



Have Merlin tell when process was started:

Get-Process | select -First 10 | foreach {$merlin.Speak($_.ProcessName + " was started " + $_.StartTime) | out-null; Start-Sleep 5 }


Microsoft Agent is being deprecated and will not be included in future versions of the Windows operating system.

EventLog: Determine Windows startup (Event Log Service)

To determine when Windows was started search for Event ID 6005 in the System Event Log. The entry should look like this:

Log Name:     System
Source:       EventLog
Event ID:     6005
User:         N/A
Computer:     computername
Description:  The Event log service was started.