header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Concatenating sting to a attribute
Last Post 12 Jan 2010 07:21 AM by cameronove. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
DatacomUser is Offline
New Member
New Member
Posts:27
Avatar

--
06 Jan 2010 09:12 PM
    Hi Guys,
    How do concatenate (say xxx) to samid for all the disabled users using quest cmdlets. E.g

    I want to search for a samaccountname "AB" and disable it and and add "xxx" as prefix to the samaccoutname (samaccountname should be like xxxAB)
    Any help will be much appreciated. Thanks
    Regards

    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    06 Jan 2010 11:39 PM
    Try this:

    Get-QADUser -SamAccountName AB | ForEach-Object { Set-QADUser $_ -SamAccountName ($_.SamAccountName+'AB') }

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    DatacomUser is Offline
    New Member
    New Member
    Posts:27
    Avatar

    --
    07 Jan 2010 09:18 PM
    Thx Shay. Works perfectly fine.Have couple of more questions. How do i pass mulitple arguments in the same query. Eg In the above query we searched for a name and appended the string. Now i want to add xxx in the description and set the expiry date to todays date.

    My quesstion is can i do it in the same query using AND. If you can explain with the above example that will be highly appreciated. Thanks Shay.
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    11 Jan 2010 08:53 AM
    Get-QADUser -SamAccountName AB | ForEach-Object {
    Set-QADUser $_ -SamAccountName ($_.SamAccountName+'AB') -Description ($_.Description+"xxx") -AccountExpires (Get-Date)
    }

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    cameronoveUser is Offline
    Basic Member
    Basic Member
    Posts:332
    Avatar

    --
    12 Jan 2010 07:21 AM
    Try this alternative...

    get-qaduser -ldapfilter '(samaccountname=ab)' | %{$_.samaccountname = "xxx$($_.samaccountname)";$_.description = "xxx$($_.description)";$_.accountexpires = (Get-Date);$_.commitchanges()}

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer