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 - how to (1) change a IIS v5 "local path" and (2) windows service pa

Reply
 
Old 04-24-2008   #1 (permalink)
Steve


 
 

how to (1) change a IIS v5 "local path" and (2) windows service pa

Can someone offer the powershell "easiest" way to:

(1) change a IIS v5 "local path" from X to Y
(2) change a windows service path from X to Y

All on Windows XP.

I need this so that i can use powershell to easily switch my applications
(asp.net web services and installed windows services) from one branch to
another to test. it's a real pain to have to manually go into IIS and reset
the vdir location, uninstall the services and reinstall in the same location,
etc.

My System SpecsSystem Spec
Old 04-24-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: how to (1) change a IIS v5 "local path" and (2) windows servicepa

Steve wrote:
Quote:

> Can someone offer the powershell "easiest" way to:
>
> (1) change a IIS v5 "local path" from X to Y
> (2) change a windows service path from X to Y
>
> All on Windows XP.
>
> I need this so that i can use powershell to easily switch my applications
> (asp.net web services and installed windows services) from one branch to
> another to test. it's a real pain to have to manually go into IIS and reset
> the vdir location, uninstall the services and reinstall in the same location,
> etc.
I'm not a pro web developer, so I'll apologize beforehand. Are you sure
you're using the proper terminology? "windows services" kind of threw
me off, for example.

I'll try to dig into it a bit more over the weekend if nobody else helps
out.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 04-26-2008   #3 (permalink)
Shay Levi


 
 

Re: how to (1) change a IIS v5 "local path" and (2) windows service pa



Hi Steve

To change the "Local Path" path for the site try:

$iis=[adsi]"IIS://localhost/W3SVC/1/Root"
$iis.path = "yourPath"
$iis.setinfo()

To change a specific VirtualDir "Local Path"

$vDir = $iis.psbase.children | where {$_.SchemaClassName -eq "IISWebVirtualDir"
-and $_.AppRoot -match "VirtualDirName"}
$vDir.Path = "yourPath"
$vDir.setinfo()



To change a service executable path:

$svc = gwmi win32_service -filter "name='alerter'"
$svc.change($null,"c:\windows\system32\cmd.exe",$null,$null,$null,$null,$null,$null,$null,$null,$null)




-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Can someone offer the powershell "easiest" way to:
>
> (1) change a IIS v5 "local path" from X to Y
> (2) change a windows service path from X to Y
> All on Windows XP.
>
> I need this so that i can use powershell to easily switch my
> applications (asp.net web services and installed windows services)
> from one branch to another to test. it's a real pain to have to
> manually go into IIS and reset the vdir location, uninstall the
> services and reinstall in the same location, etc.
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
"Extensible Authentication Protocol" service gives "The system cannot find the file specified" error Vista networking & sharing
VBScript to Change only "maximum password age" in Local User Accou VB Script
How to config "local machine"-->"personal" access right? Vista General
How to change "require trusted path for credential entry" Vista account administration
"Open command prompt here" and "Copy as path" Vista performance & maintenance


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