Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Cannot validate argument on parameter 'MySiteHostLocation'. The argument is null....

Cannot validate argument on parameter 'MySiteHostLocation'. The argument is null....

Cannot validate argument on parameter 'MySiteHostLocation'. The argument is null....

This one's been killing me all week. Thankfully a short week!

This snippet of a script connects to a SharePoint "app" server using PS Remoting and attempts to update the profile photos. Problem is, its telling me that one of the arguments is empty, but I cannot fathom why. Everything I have done to test suggests it has a value.


function updateSP(){
         $SPServer = ('PLVSSPAPP01','LVVSSPAPP01'),('DOMAIN\SA-SPAdmin-PL','DOMAIN\SA-SPAdmin-L'),('http://mysites-pl','http://mysites')
	#Iterates through each server in $SPServer array
	for($i=0; $i -lt $SPServer[0].length; $i++) {
		$server = $SPServer[0][$i] 
		$user = $SPServer[1][$i] 
		$mySitesUrl = $SPServer[2][$i]
		echo $server $user $Commandline $mySitesUrl
        # This Script block is a way of combining multiple commands:
        $myScriptBlock1 = {
            Add-PSSnapin Microsoft.SharePoint.PowerShell
            update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation $mySitesUrl
	$crd = credentials $server $user
	$session = New-PSSession -ComputerName $server -Authentication 'Credssp' -Credential $crd #-AllowRedirection
	Invoke-Command -Session $session -ScriptBlock $myScriptBlock1
	Write-Host "Sharepoint updated on $server, $mySitesUrl."
         Write-Host " "
	Remove-PSSession $Session
	Write-Error "Error trying to connect to $server : $error"

The error:


Cannot validate argument on parameter 'MySiteHostLocation'. The argument is null. Supply a non-null argument and try the command again.
    + CategoryInfo          : InvalidData: (:) [Update-SPProfilePhotoStore], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletUserProfilePhotoStore 

In the echo line, $mySitesUrl (line 9)comes back with the correct value from the array.

If anyone could shed any light on why this script thinks it -MySiteHostLocation is blank I'd be very grateful.

Many thanks


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close