Thursday 26 December 2013

PowerShell Script to read SiteUrl's from Text file

Create text file fore example : SiteUrls.txt

http://sedwdevrtm:22222/sites/abc
http://sedwdevrtm:22222/sites/bcd
http://sedwdevrtm:22222/sites/def
http://sedwdevrtm:22222/sites/xyz

PowerShell Script to read SiteUrl's from Text file


 clear

# Read the text file by using " Get-Content " Powershell Command

$data=Get-Content "C:\SiteUrls.txt"

 Write-Host "Site count" is  $data.Count

 #Loop through each line in text file using foreach and display using Write-host

foreach($d in $data)
    {
   
     Write-Host  -BackgroundColor DarkYellow $d

    } 



Output :




No comments:

Post a Comment