23 July 2015

Extract links froma web site and download multiple files with Poweshell Script

Few weeks ago, I've posted about how to download multiple files from web using powershell. In this post I'm going to show you a script that retrieves the links from a given web site and downloads the files to a given directory on your local machine.



#place to store downloaded files
$filepath = Read-Host "Please enter the location to store the files.(eg. C:\Downloads\)"
$webSite = Read-Host "Please enter the site url that contains the links: (eg. https://www.example.com/photos)"
#gathering link details from source web
$links = ((Invoke-WebRequest Uri $webSite).Links)
#downloading...
foreach($link in $links) {
#link to files
$item = $webSite + $link.href
Write-Host Url: $item
# innertext contains the file name
Write-Host Title:  $link.innerText
#download path on local machine
$path = $filepath + $link.innerText
Write-Host $path
#downloading files
Start-BitsTransfer $item  $path

}

08 July 2015

IIS error when installing SharePoint 2013 on Windows Server 2012 R2 : The tool was unable to install Application Server Role, Web Server (IIS) Role


This error has cost me five or six hours. Then I tried everything from applying patches, trying to install IIS manually, etc. Once I figured it out, I installed SharePoint Server and went with my life happily.
It happened to one of my colleague and I couldn't remember what fix I did a month ago. Later, I figured it out and solved. I'm documenting it here so that if anyone come across the same issue, they can solve it.

This error occurred because the pre-request installer is trying to execute ServerManagerCmd.exe from system 32 folder and failing. (I found out this from the pre-request installer logs). So I get in to the system32 folder to see what this fuss about. Voila! There was no ServerManagerCmd.exe in the folder, instead there was a ServerManager.exe. Looks like the executable file was renamed in WS 2012 R2.

So, I made duplicate copy of ServerManager.exe by copy and pasting in the same folder(system32), then renamed the copy as  ServerManagerCmd.exe. Ran the pre-request installer again and installed successfully.

Summary

Issue: The tool was unable to install Application Server Role, Web Server (IIS)

Solution:
                Step 1: Navigate to system32 folder (C:\Windows\system32)
                Step 2: Copy ServerManager.exe and paste in the same location. (system32 folder)
                Step 3: Rename ServerManager-Copy.exe to ServerManagerCmd.exe
                Step 4: Run the pre-request installer

By the way, SharePoint 2013 with SP1 works fine without any workarounds. So, If you have Windows Server 2012 R2, it is recommended to install SharePoint 2013 with SP1.