Using the Get-Item cmdlet instead of Get-Website in order to avoid the issue described in the following thread(http://forums.iis.net/p/1167298/1943273.aspx)
Adding retry logic for querying the sites, because the WebAdministration module is not always being loaded in the moment of execution of the Get-Item cmdlet.