Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Simple doubt

Reply
 
Old 06-28-2007   #1 (permalink)
Techstarts


 
 

Simple doubt

I want to open http://servername:2381 using powershell.

$servername=$args
#$colon=':'
#$port=2381
$fullpath=$servername+$colon+$port
$oIE=new-object -com internetexplorer.application
$oIE.navigate2("https://$fullpath")
$oIE.Visible=$true

But this doesn't work, it takes spaces...Need simple advice to achieve
it.

Thank you for your kind advice.
Preetam


My System SpecsSystem Spec
Old 06-28-2007   #2 (permalink)
klumsy@xtra.co.nz


 
 

Re: Simple doubt


so the first thing is you have the colon and port commented out..
is the other issue that the SERVERNAME has spaces in it?
i can't recall off the top of my head, but in System.Web there are
some utility functions specifically for URLs and encoding %20 etc


My System SpecsSystem Spec
Old 06-28-2007   #3 (permalink)
Kiron


 
 

Re: Simple doubt

You are assigning $args to $servername. $args is one of PowerShell's
automatic variables and it will contain unassigned parameters passed to a
function or a script.
Assign 'servername:2381' instead:

$servername='servername:2381'
#$colon=':'
#$port=2381
$fullpath=$servername+$colon+$port
$oIE=new-object -com internetexplorer.application
$oIE.navigate2("https://$fullpath")
$oIE.Visible=$true

....or this way:

$server name='server name'
$colon=':'
$port=2381
$full path=$servername+$colon+$port
$oIE=new-object -com internetexplorer.application
$oIE.navigate2("https://$fullpath")
$oIE.Visible=$true

If you want to read about automatic variables:

help about_automatic_variables

--
Kiron

My System SpecsSystem Spec
Old 06-28-2007   #4 (permalink)
Kiron


 
 

Re: Simple doubt

Typo on the second option:

$servername='server name'

....should be:

$servername='servername'
$colon=':'
$port=2381
$fullpath=$servername+$colon+$port
$oIE=new-object -com internetexplorer.application
$oIE.navigate2("https://$fullpath")
$oIE.Visible=$true

Sorry.

--
Kiron
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Doubt in word Microsoft Office
I doubt you can help but doesn't hurt to ask Network & Sharing
clarify my doubt Vista installation & setup
For those in doubt of Microsoft shares... Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46