Hi all,
I'm used to cmd scripting, and struggle to find Powershell counterparts for some common scripting techniques.
Let's examine the following example:
Let's say I want to show just the custom 'App' vdirs, and the 2nd property of them (logical path). In cmd I'd do something like:
How can I do this in PowerShell? (putting the result in an array of strings)
I'm used to cmd scripting, and struggle to find Powershell counterparts for some common scripting techniques.
Let's examine the following example:
Code:
C:\Windows\System32\inetsrv>appcmd.exe list vdir
VDIR "Default Web Site/" (physicalPath:C:\inetpub\[URL unfurl="true"]wwwroot)[/URL]
VDIR "Webshop/" (physicalPath:C:\InetPub\Webshop)
VDIR "Webshop/App0/" (physicalPath:C:\Inetpub\Webshop\App0)
VDIR "Webshop/App1/" (physicalPath:C:\Inetpub\Webshop\App1)
VDIR "Webshop/App2/" (physicalPath:C:\Inetpub\Webshop\App2)
VDIR "Webshop/App3/" (physicalPath:C:\Inetpub\Webshop\App3)
VDIR "Webshop/App4/" (physicalPath:C:\Inetpub\Webshop\App4)
VDIR "Webshop/App5/" (physicalPath:C:\Inetpub\Webshop\App5)
VDIR "Webshop/App6/" (physicalPath:C:\Inetpub\Webshop\App6)
Let's say I want to show just the custom 'App' vdirs, and the 2nd property of them (logical path). In cmd I'd do something like:
Code:
C:\Windows\System32\inetsrv>for /f "tokens=2" %i in ('"appcmd.exe list vdir | find "App""') do @echo %i
"Webshop/App0/"
"Webshop/App1/"
"Webshop/App2/"
"Webshop/App3/"
"Webshop/App4/"
"Webshop/App5/"
"Webshop/App6/"
How can I do this in PowerShell? (putting the result in an array of strings)