The ArcGIS Online & Portal toolkit contains a number of tools and scripts to administer Portal for ArcGIS and ArcGIS Online.