create a profile path and add the permission as well

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 7 months ago.

  • Author
    Posts
  • #5655

    by alizpak at 2013-03-12 06:34:14

    Hi Guys,

    I have design a script which is not working, What I wanted is when script run it can create the homedirectory on the path adds the profile path tsprofile path roming profile path on AD account also add the user permission to their home directory as well. Please help

    $cred = get-credential domain\ali
    $conn = connect-QADService -service domain.com -credential $cred
    $import=import-csv -Path "C:\Ali\user.csv"

    foreach($dataRecord in $import)
    {
    $sAMAccountName=$dataRecord.SamAccountName

    $user=get-QADUser -identity $sAMAccountName

    Set-QADUser -identity $SAMaccountname -HomeDirectory '\\Server\user$\User1\%username%' -HomeDrive 'L:' -Profilepath '\\server\profile$\%username%' -tsprofilepath '\\server\user$\User1\%username%\metaP'
    }

    by alizpak at 2013-03-13 01:43:20

    Hello,

    I have redesign my script every thing is working apart from last line of my script which is TSprofilepath is not working and its giving me below error message.

    Set-QADUser : Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWN
    NAME))
    At line:1 char:12
    + Set-QADUser < <<< -Identity test02 -TsProfilePath \\Datashare\User$\Us
    er1\test02 -credential domain\ali
    + CategoryInfo : NotSpecified: (:) [Set-QADUser], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Ques
    t.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.SetUserCmdlet

    set-Location c:\
    add-PSSnapin quest.activeroles.admanagement
    $cred = get-credential domain\ali
    $conn = connect-QADService -service domain.com -credential $cred
    $import=import-csv -Path "C:\Ali\user.csv"
    foreach($dataRecord in $import)
    {
    $sAMAccountName=$dataRecord.SamAccountName

    $user=get-QADUser -identity $sAMAccountName
    $varUserHome = "\\Datashare\user$\User1\" + $sAMAccountName
    $varuserprofilepath = "\\Datashare\profile$\" + $sAMAccountName
    $varusertsprofilepath = "\\Datashare\user$\User1\" + $sAMAccountName + "\MetaFrameXP"

    Set-QADUser -identity $SamAccountname -HomeDirectory $varUserHome
    Set-QADUser -identity $SamAccountname -HomeDrive "L:"
    Set-QADUser -identity $SamAccountname -Profilepath $varuserprofilepath
    Set-QADUser -identity $SamAccountname -tsprofilepath $varusertsprofilepath
    }

    by alizpak at 2013-03-13 02:53:49

    I resolved this problem it was a permission issue on my AD account did not had the full admin rights to amend the TS paths on AD.

You must be logged in to reply to this topic.