Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

I need to modify the root URL but leave the rest in Favorites.

$
0
0

We're changing several SharePoint web sites to use SSL and FQDN only.

Every user has at least one of the sites in their favorites folder.

I need to change the base URL from http://{netbios name}/sites/default.aspx (or the like) tohttps://FQDN/sites/default.aspx (or the like)

What I have so far works for the change, but drops everything after the "base" URL:

$favourites_path = [System.Environment]::GetFolderPath('Favorites')

Copy-Item $favourites_path "$favourites_path`1" -Recurse

$favourites = Get-ChildItem($favourites_path) -Recurse -Filter *.url

foreach ($favourite in $favourites) {

    $shortcut = (New-Object -ComObject 'WScript.Shell').CreateShortCut($favourite.FullName)

    $new_path = switch -Wildcard ($shortcut.TargetPath) {

        ("http://wss1/*") { 'https://wss1.fqdn.com'; break }
        ("http://iwds/*") { 'https://iwds.fqdn.com'; break }
        ("http://webshare/*") { 'https://webshare.fqdn.com'; break }
        ("http://mysites/*") { 'https://mysites.fqdn.com'; break }
        ("http://eforms/*") { 'https://eforms.fqdn.com'; break }
        default { $_ }
    }

    $shortcut.TargetPath = $new_path
    $shortcut.Save()

}

I've tried adding the wildcard at the end of the new url, but it's a literal translation " http://eforms.fqdn.com/* "

Can someone show me how to get the wildcard data from the old url in to the new url?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>