Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get URL with SiteID using PowerShell

Posted on 2013-12-12
8
Medium Priority
?
7,488 Views
Last Modified: 2013-12-12
I ran a sql command and all I have to work with is the SiteID and WebID. How can I use those GUID to produce a URL using PowerShell?
0
Comment
Question by:exonedge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39714038
Hi,
which SharePoint version and edition?
What do you try to achieve?
Direct queries using SQL commands against Sharepoint databases are a no-go!
And you should be able to use the commandlets Get-SPWeb / Get-SPSite providing the parameter -Identity and the guid to get the objects. Then you can use the various properties to get the urls.
HTH
Rainer
0
 
LVL 1

Expert Comment

by:Sunny_2009
ID: 39714300
Save All SiteID in E:\temp\SiteID.txt with each ID on new line and run below script .

Script :
=====================================
$content = Get-Content E:\temp\SiteID.txt
foreach($line in $content)
{
$site = Get-SpSite $line
$site.Url + "," + $site.Id.Guid | out-file E:\temp\SiteUrl.txt -append -width 1000
}
Write-Host "Completed"

Open in new window


===============================
Hope this helps you
0
 

Author Comment

by:exonedge
ID: 39714621
I am trying to track down a workflow that is causing issues and I found it in sql against a Nintex Database, but the query in sql does not provide a URL. It only provides the SiteID and WebID. I need the URL to track down the workflow. I have been working with a Microsoft tech on this as well and they are the ones that started me off with queries against the SharePoint database. I can ask the Microsoft tech I am working with for the command line to get this also now that I think of it.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39714736
Hi,
OK - I just wanted to explicitely mention, that esp. updating data inside SharePoint database will result in an unsupported environment/farm.

So you should be able to get the url by using:
Get-SPWeb -Site 5953f454-5681-45b8-b2b0-c28a74608e11 | WHERE  {$_.Id -eq "d30d787b-9c5c-4deb-8e05-0a597f1bdf38"} | Select Url, Title

Open in new window


where the first GUID is the Site GUID (id) and the second one the web guid (id).

HTH
Rainer
0
 

Author Comment

by:exonedge
ID: 39714745
What you gave me almost worked. It provided me with http://hostname/managed Path/site guid but no site url.
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 2000 total points
ID: 39714824
Sorry,
I do not understand your response.

The above command should return the Url of the SPWeb as well as the title - and this worked on my dev environment (SharePoint Server 2010 Enterprise).

If you need the url of the SPSite then use:
Get-SPSite -identity 5953f454-5681-45b8-b2b0-c28a74608e11 | Select Url

Open in new window

0
 

Author Comment

by:exonedge
ID: 39714826
That was it, thank you! If it makes you feel any better we are not making changes to the database. We are just looking up info.
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39714853
Hi,
glad that it worked :-D

Thanks for the points and it is not about me - I just do not want that someone is getting into a really really ugly situation where MS support just decline any service due to an unsupported state of the farm (I experienced this once - and trust me - the responsible SharePoint "admin" had to look quickly for a new job). And SharePoint is not only complex but also due to the complexity and flexibility "buggy" - and in some situations only MS support can deeply analyze the root cause.

KR
Rainer
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

670 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