Share via

PowerShell Script giving error

Anonymous
2022-10-14T19:08:46+00:00

I am using below PowerShell script to update manager attribute of guest users as their inviter.

Import-CSV ‪C:\Users\Admin\AuditLog\AuditLogs_2022-10-14.csv | % { Set-AzureADUserManager -ObjectId $_.Target1ObjectId -RefObjectId $_.ActorObjectId }

Script is working and manager field is also getting updated but still its giving below error message.

Set-AzureADUserManager : Cannot bind argument to parameter 'ObjectId' because it is an empty string.

At line:1 char:101

  • ... csv | % { Set-AzureADUserManager -ObjectId $_.Target1ObjectId -RefObj ...
  •                                            ~~~~~~~~~~~~~~~~~~ 
    
    • CategoryInfo : InvalidData: (:) [Set-AzureADUserManager], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.Open.AzureAD16.PowerShell.SetUserManager

Set-AzureADUserManager : Cannot bind argument to parameter 'ObjectId' because it is an empty string.

At line:1 char:101

  • ... csv | % { Set-AzureADUserManager -ObjectId $_.Target1ObjectId -RefObj ...
  •                                            ~~~~~~~~~~~~~~~~~~ 
    
    • CategoryInfo : InvalidData: (:) [Set-AzureADUserManager], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.Open.AzureAD16.PowerShell.SetUserManager

Set-AzureADUserManager : Cannot bind argument to parameter 'ObjectId' because it is an empty string.

At line:1 char:101

  • ... csv | % { Set-AzureADUserManager -ObjectId $_.Target1ObjectId -RefObj ...
  •                                            ~~~~~~~~~~~~~~~~~~ 
    
    • CategoryInfo : InvalidData: (:) [Set-AzureADUserManager], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.Open.AzureAD16.PowerShell.SetUserManager

Set-AzureADUserManager : Cannot bind argument to parameter 'ObjectId' because it is an empty string.

At line:1 char:101

  • ... csv | % { Set-AzureADUserManager -ObjectId $_.Target1ObjectId -RefObj ...
  •                                            ~~~~~~~~~~~~~~~~~~ 
    
    • CategoryInfo : InvalidData: (:) [Set-AzureADUserManager], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.Open.AzureAD16.PowerShell.SetUserManager

Set-AzureADUserManager : Cannot bind argument to parameter 'ObjectId' because it is an empty string.

At line:1 char:101

  • ... csv | % { Set-AzureADUserManager -ObjectId $_.Target1ObjectId -RefObj ...
  •                                            ~~~~~~~~~~~~~~~~~~ 
    
    • CategoryInfo : InvalidData: (:) [Set-AzureADUserManager], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.Open.AzureAD16.PowerShell.SetUserManager
Microsoft 365 and Office | Install, redeem, activate | For education | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. NoOneCan 7,795 Reputation points Volunteer Moderator
    2022-10-15T16:06:23+00:00

    You may post your issue in the PowerShell community forum. For details see link: https://learn.microsoft.com/en-us/powershell/scripting/community/community-support?view=powershell-7.2

    Was this answer helpful?

    0 comments No comments