Solved

Powershell script that finds the value in the Redirect To: field in IIS 6?

Posted on 2010-09-14
2
543 Views
Last Modified: 2012-05-10
Here's the problem, we're migrating from one web server to another.  We have a site that has numerous folders that are configured to redirect to a URL.  I'm going to guess that the radio button labeled "A redirection to a URL" and the form field labeled "Redirect To" are properties that can be searched using a script.

I need to search for and find each one of these folders that does a redirect.

If a Powershell script can help me find these redirects, would someone help me out with the script?  

I'm not asking for a script that will loop through each folder, I'll plug them into the script one folder at a time.

Something like get-childitem c:data -recurse | get-acl | export-csv c:\filename.csv
But instead of getting the acl, get the value for the radio button or the value in the Redirect To field.



0
Comment
Question by:mobot
2 Comments
 
LVL 17

Accepted Solution

by:
Tony Massa earned 500 total points
ID: 33676812
See if this helps.  The "Name" value may not be too helpful, but it will list all of the redirected URLs
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("SELECT * FROM IIsWebVirtualDirSetting WHERE HttpRedirect != ''")
 
For Each objItem in colItems
    Wscript.Echo "Http Redirect: " & objItem.HttpRedirect
    Wscript.Echo "Name: " & objItem.Name
Next

Open in new window

0
 

Author Closing Comment

by:mobot
ID: 33739033
Sorry, I got sidetracked on another project.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now