I am trying to get this powershell code to work, but to no avail. I get the following error:
Set-GPLink : Cannot validate argument on parameter 'Target'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
Here's the code :
function gpo_order([string]$nom_gpo,[string]$nom_ou,[int]$nombre)
{
if ($nom_gpo.TEXT -eq "")
{
$erreur.Text = "Vous devez entrer un nom de gpo"
}
Elseif ($nom_ou.TEXT -eq "")
{
$erreur.Text = "Vous devez entrer un nom de OU sous la forme 'ou=Bureautique,ou=Desjardins,dc=mvt,dc=desjardins,dc=com'"
}
Elseif ($gpo_rang.TEXT -eq "")
{
$erreur.Text = "Vous devez entrer un numéro de rang pour la gpo"
}
else
{
****Set-GPLink -Name $nom_gpo -Target $nom_ou -Order $nombre****
}
}
I cannot figure out the problem.