A Powershell Inspired Prank

Here is a good joke to play on one of your developer buddies if they have powershell and SQL Server installed on their local machines and you have sa rights on the SQL Server for whatever reason (former debugging help, open environment between developers, blank sa password, or mad hacker skills on your part). Wait until they are busy typing and execute the following query in Query Analyzer (or using sqlcmd.exe if you want to be a purist) against their SQL Server. You may want to lock down your own machine before trying this in order to avoid certain retribution…:-)

master..xp_cmdshell “powershell.exe (new-object -com ‘SAPI.spvoice’).speak(’Ouch. You are typing too hard’)”

This is a little more difficult with SQL 2005 because remote connections and xp_cmdshell are both disabled by default for obvious security reasons. You can enable remote connections by adding exceptions to the windows firewall for SQLServer and SQL Browser as described in the following KB article. You can enable xp_cmdshell in SQL 2005 with the following script:

EXECUTE sp_configure ’show advanced options’, 1
RECONFIGURE WITH OVERRIDE
GO
EXECUTE sp_configure ‘xp_cmdshell’,
‘1′
RECONFIGURE WITH OVERRIDE
GO
EXECUTE sp_configure ’show advanced options’, 0
RECONFIGURE WITH OVERRIDE
GO

If you’re really itching to do this prank but they don’t have Powershell or SQL Server installed, there are still lots of options. All you really need is a way to shell out a command against someone else’s computer since the underlying voice capabilities come from a COM component, which you can call from vbs script. Have fun…

No Comment

No comments yet

Leave a reply