i use metasploit for pentesting windows 2003 sp2 server but when windows firewall is on i am not able to perform pentest successfully is there any way to disable firewall remotly?
If you have to disable the firewall in order to run a particular exploit then that test demonstrates the firewall is working effectively as a mitigating control. Which is generally the aim of a 'pen test'
Once you disable the firewall, many exploits are likely to work (I'm thinking zero days as well as all services with unpatched vulnerabilities) so it doesn't really add value.
Metasploit is a useful tool for automating simple or tedious exploits, but if you are at the point of needing to disable the firewall in order to run it, you are probably barking up the wrong tree.
I had a pentest, where I was able to get in using one exploit, but needed the firewall to be disabled for some other access. I found these 2 links to be extremely helpful towards disabling the firewall from a command line remotely:
For XP & Windows 2003: Netsh firewall set opmode disable
For Windows 7 and 2008: netsh advfirewall set currentprofile state off
For both of these, you will need Administrator access. If you're trying to disable the firewall before gaining any sort of access, you're pretty much out of luck.