Link to home
Start Free TrialLog in
Avatar of janhoedt
janhoedt

asked on

Powershell: find specific link (servername) in Sharepoint page and show it?

Hi,

I have this sharepoint link:
http://ourserver.ourdomain.com/Asset%20database/Servers.aspx on which there is an entry for each server.
F.e.
Hostname  Function
Server01  Exchange server
Server02  Database
Etc

Each hostname is a link which gives full details when you click on it.
Now I would like to be able to look for Server01 via Powershell and show the output in a webbrowser.
Tried via
$webclient = New-Object system.net.webclient
$content = $webclient.DownloadString("http://ourserver.ourdomain.com/Asset%20database/Servers.aspx")
Idea was then to find the link in the $content then make Powershell look for link and show it, but get an access denied on the downloadstring.

Please advise howto achieve this.
J.
Avatar of Justin Yeung
Justin Yeung
Flag of United States of America image

You can do invoke-webrequest (you can use -Credential)

$url = "http://ourserver.ourdomain.com/Asset%20database/Servers.aspx "
$html = Invoke-WebRequest -Uri $URL -UseDefaultCredentials

Open in new window


you will just have to filter $html.parsedhtml.body.innerHTML with what ever you need.

what I have done is to define variable of what info that I need and build a html report and then sends out notification email.
Avatar of janhoedt
janhoedt

ASKER

Ok, now I get this but nothing much I can do with it either:

StatusCode        : 200
StatusDescription : OK
Content           :
                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                    <html xmlns:o="urn:schemas-microsoft-com:office:office" lang="en-us" dir="ltr">
                    <head...
RawContent        : HTTP/1.1 200 OK
                    SPRequestGuid: d7af50d3-2f90-4156-aa2a-47ad72678eec
                    X-SharePointHealthScore: 1
                    Persistent-Auth: false
                    MicrosoftSharePointTeamServices: 14.0.0.7006
                    X-MS-InvokeApp: 1; RequireReadOn...
Forms             : {aspnetForm}
Headers           :
Images                :
InputFields:
Links:
ParsedHtml:
RawContentLength:
Also  $html.parsedhtml.body.innerHTML doesn't reveal the servername(s)
ASKER CERTIFIED SOLUTION
Avatar of Justin Yeung
Justin Yeung
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial