Hello:
I have looked on this forum for tips to use a custom script in the user creation template using powershell passing the %username% argument. I have attempted this with a script to create a folder using the new username as the name of the folder without success. I hope someone can tell me what I'm doing wrong.
Syntax in the "Script Command" field is:
powershell .\CreateFolder.ps1 -Arg1 %username%
Code of the ps1 file is:
I am getting this error:
Custom Script Result :New-Item : Item with specified name
\\servername\share\ already exists. At C:\ManageEngine\ADManager Plus\bin\CreateFolder.ps1:1 char:9 + new-item <<<< -itemtype directory -path "
\\servername\share\$Arg1" + CategoryInfo : ResourceExists: (
\\servername\share\:String) [New-Item], IOException + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.New ItemCommand
Running the powershell code above replacing $Arg1 with other text it creates the folder.
Appears from the error it's not seeing th Arg1 at all and thinks it's trying to create "share" folder instead. The folder/sting for %username% does not exist at the share location.
Thanks for any help.