Skip to main content

Posts

Showing posts from May, 2015

Use SendKeys in PowerShell

Script below will use SendKeys in PowerShell, the old fashioned way. Script below will open a Notepad and type or send some string to notepad. It will also open windows calculator and do some calculation. Here's the script: #==================================== $wshell = New-Object -ComObject Wscript.Shell #Call notepad and run it $wshell.Run("notepad") #Delay for 1 second Start-Sleep -m 1000 #Send keys to notepad $wshell.SendKeys("123 test 456") #Delay for 2 seconds Start-Sleep -m 2000 #Run Windows Calculator $wshell.Run("calc") #Set the window focus to calculator #Don't click or press the keyboard or mouse so focus will not be changed $wshell.appactivate("Calculator") #sleep again for 1 second Start-Sleep -m 1000 #Do the calculation by sending keys to calculator $wshell.SendKeys("5") $wshell.SendKeys("*") $wshell.SendKeys("5") $wshell.SendKeys("=") #===================================...

Burn an ISO file in Windows 7 or 8

Use command line to burn an ISO file in Windows. Windows 7 and Windows 8 comes with an exe file to burn an ISO file via command prompt. The syntax is quite easy to remember. Open a command prompt and type: isoburn /q a: Windows_and_Linux.iso isoburn /q ISOFilename.to.be.burn That's it, ISO will be burn to disc. See picture below if no disc on the drive, when burning an ISO file via command prompt.

VB.NET Sql Server Cannot Login

I had database application which works fine if it runs locally. But running the program on other computer or via network, it fails. It shows the error "Unhandled exception has occured in your application"; "Cannot open database db_name requested by the login." On my application the issue was the connection string on the code. This code below runs fine on my application. I'm using VB 2010 for my program. con.ConnectionString = "Data Source=192.168.1.150,1433;Database=MyDBx;User ID=dbsa;Password=db007" 1433 is the default port for Microsoft SQL; if this was changed you need to enter the correct port. To check if port 1433 is listening for connections, open a command prompt and type: netstat -an | find "1433" If everything is set correctly output will show like this: TCP    0.0.0.0:1433           0.0.0.0:0            ...

Manage Windows files and folder security permissions via command line

On Windows 7, Windows 8 and even Windows 2012, icacls.exe can be used to manage files and folder security permissions using command line. Don't experiment on the production environment unless you know what you are doing. Below are some examples on how to manage files and folder security permissions using command line in Windows. Type, icacls  /?  To show examples and other options via command prompt. Gives Full access to the folder specified on the path. icacls "d:\public notes" /grant domain_name\everyone:F Gives Read access only to the folder specified on the path. icacls "d:\public notes" /grant domain_name\everyone:R Gives Read and Execute access to the folder specified on the path. icacls "d:\public notes" /grant domain_name\everyone:RX Gives Read and Write access to the folder specified on the path. icacls "d:\public notes" /grant domain_name\everyone:(WDAC) Gives Read, Delete a...