Archive for March, 2010

I needed to download directory from ftp server modify it and uploaded back to server using powershell. At fist i found that [System.Net.WebRequestMethods+Ftp]::UploadFile and [System.Net.WebRequestMethods+Ftp]::DownloadFile works fine and in real life when my zip file size is bigger it does not work.

I have not found any solution to make it working so I used alternative way to solve it. I have written two batch fildes upload.bat and downlaod.bat and calling these batch files from my PS Script to execute.

Actually if anyone use bat file he/she need not to call the bat file from PS Scripts but in my case after downloading zip file from ftp server I modified many things in the files using powershell and then upload it back to server.

Here are the batch files you can try if needed upload.bat and download.bat


Read Full Post »

to rename a file we use Rename-Item command in powershell the command is very simple

Rename-Item $source $dest -force

But what about changing a folder/directory name? I made mistake to write the same command in case of folder/directory rename and it does not work, shows exception file not found which proves that the command is searching for a file not ready to rename and folder/directory.

After googling for some minutes I found the solution and the command is

Rename-Item -path $destFolder -newName $folderNewName

Example: Rename-Item -path ‘C:\AshrafTest\MyFolder’ -newName ‘MyFolder_New’

By the way the folder should contain some data to be rename. Pretty simple but wasted time to search internet so sharing 🙂

Read Full Post »

Automate internet explorer

Recently I was trying to automate one step of my internet explorer actually my automation step was very simple I just needed to navigate an URL, read DOM of the URL, get text boxes and enter data in it. After entering data in text boxes I was suppose to click on login button.

Actually one of my 3rd party tool is depending on the login and was trying to automate the login and run the 3rd party tool so I need not to go to server everyday and do that.

It is easy to automate Internet Explorer by using a COM control named Microsoft Internet Controls (SHDocVw). To browse the DOM Microsoft.mshtml is used. I found a very helpful article with code in codeproject.com. here is the article : Automating Internet Explorer

By the way, I was facing problem to insert data in the text box  and click button. It worked fine in my local computer where VS is installed but for the computers where VS is not installed it shown exception to convert _Comobject to mshtml.HTMLInputElementClass . Download modified file.

Read Full Post »

My experiences says that we always suffer for asp.net application. because most of us use many tools for hosting and different provider gives different control panel. Overall it waste a lost of time to make the preparation of deployment in a shared hosting and at the time of hosting we face lots of problem too.

Today I watched a video in asp.net site which shown very clearly how we can easily deploy asp.net application in a shared hosting just using iis7 and visual studio. This is really a nice video. dot net developers who need to deploy products regularly in shared hosting should watch the video for faster deployment.

Watch the video here : Developing and Deploying In a Shared Hosting

Developing and Deploying In a Shared Hosting

Read Full Post »