Analyze URL


posted by Tobias Weltner
11-27-2008

Downloads: 357
File size: 188 B
Views: 1,521

Embed
Analyze URL
  1. $result = [System.uri]'http://powershell.com/cs/forums/' 
  2. $result 
  3.  
  4. "You are using Port $($result.port)." 
  5. "Page comes from $($result.Authority)." 
  6. "Served using $($result.Scheme)." 
Filed under: , ,
Sometimes, you may want to disassemble a URL and retrieve specific information, for example the port used, the top level domain or the url scheme. Instead of manually extracting this information, simply cast the URL to System.URI. Then, all information about your URL is conveniently accessible via individual properties.
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.