1

Hi i need to compare 2 sharepoint site urls using powershell script. So that once the url is compared it should go into some loop for deactivatng a feature in only one site in a bunch of webapp and activate in all other webapp. I have done with the code. But my condition if($site -eq "url") is not taking me into the loop i debugged the code and checked both sides same url is only coming. thanks

  • 2
    Can you show us wat you already got? – Remko Jan 3 '14 at 11:04
  • What is in $site, the whole object or only the Url? You should do if($site.Url -eq "blabla") if you have the whole SPSite / SPWeb object stored in $site – Robert Lindgren Jan 3 '14 at 11:40
  • Please provide the script you have already created. – Funi Magnússon Jan 3 '14 at 12:04
2

Just do this,

$URLa = "http....a"
$URLb = "http....b"

$c = $URLa.CompareTo($URLb)

if($c) ....
  • am comparing one particular url with all the site url eg: $site="myurl" in foreach loop. So i cant hardcode the value for $site which is coming dynamically each turn. If required i will give my code what am using. Require suggestion. – priya Jan 3 '14 at 11:09
  • 1
    You do not need to hardcode anything above, just store the values of each site URL from the objects you are retrieving in two variables.. – Robert Lindgren Jan 3 '14 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.