![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| | |||||||
| |
| 05-15-2009 | #1 (permalink) |
| | Set home directory with Pipe I'm ashamed to post a question like this, but I may be very tired !! Get-qaduser UserName | Set-QADUser -HomeDirectory "\\SBS02\Userdata\ $_.logonname" -HomeDrive "H" $_.logonname is not replaced with what it should be ! |
| My System Specs |
| 05-15-2009 | #2 (permalink) |
| | Re: Set home directory with Pipe I've tried this too get-qaduser Username| Set-QADUser -HomeDirectory "\\SBS02\Userdata\$ ($_.logonname)" -HomeDrive "H" but it set the value only with \\SBS02\Userdata\ |
| My System Specs |
| 05-15-2009 | #3 (permalink) |
| | Re: Set home directory with Pipe This is my solution bu I think is is ugly get-qaduser | ? {$_.dn -match "lauder" -and !$_.homedirectory} | foreach {$d="\\SBS02\Userdata\"+$_.logonname ; Set-QADUser $_.dn - HomeDirectory $d -HomeDrive "H"} |
| My System Specs |
| 05-15-2009 | #4 (permalink) |
| | Re: Set home directory with Pipe If Set-QADUser can handle input selection like that, your only problem is that $_.logonname needs evaluation since it is in quotes: Get-qaduser UserName | Set-QADUser -HomeDirectory "\\SBS02\Userdata\$($_.logonname)" -HomeDrive "H" If it doesn't, you'll need to do this instead: Get-qaduser UserName | %{ Set-QADUser -HomeDirectory "\\SBS02\Userdata\$($_.logonname)" -HomeDrive "H"} "Personne" <cpdivers@xxxxxx> wrote in message news:5f6f5bf8-ea1d-4a0f-be5f-d320dbe14672@xxxxxx Quote: > I'm ashamed to post a question like this, but I may be very tired !! > > Get-qaduser UserName | Set-QADUser -HomeDirectory "\\SBS02\Userdata\ > $_.logonname" -HomeDrive "H" > > $_.logonname is not replaced with what it should be ! > > |
| My System Specs |
| 05-15-2009 | #5 (permalink) |
| | Re: Set home directory with Pipe On May 15, 12:28*pm, Personne <cpdiv...@xxxxxx> wrote: Quote: > This is my solution bu I think is is ugly > > get-qaduser | ? {$_.dn -match "lauder" -and !$_.homedirectory} | > foreach {$d="\\SBS02\Userdata\"+$_.logonname ; Set-QADUser $_.dn - > HomeDirectory $d -HomeDrive "H"} use this notation: Get-qaduser UserName | Set-QADUser -HomeDirectory "\\SBS02\Userdata\$($_.logonname)" - HomeDrive "H" This lets PowerShell know that you want to evaluate the value inside the parentheses and then interpolate it into the string. |
| My System Specs |
| 05-15-2009 | #6 (permalink) |
| | Re: Set home directory with Pipe As I've said in my 12:15 message Get-qaduser UserName | Set-QADUser -HomeDirectory "\\SBS02\Userdata\$ ($_.logonname)" -HomeDrive "H" This one doesn't work |
| My System Specs |
| 05-15-2009 | #7 (permalink) |
| | Re: Set home directory with Pipe Try this: Get-QADUser userName | foreach { Set-QADUser $_ -HomeDirectory "\\SBS02\Userdata\$($_.logonname)" -HomeDrive "L" } --- Shay Levy Windows PowerShell MVP http://blogs.microsoft.co.il/blogs/ScriptFanatic PowerShell Toolbar: http://tinyurl.com/PSToolbar P> As I've said in my 12:15 message P> P> Get-qaduser UserName | Set-QADUser -HomeDirectory P> "\\SBS02\Userdata\$ ($_.logonname)" -HomeDrive "H" P> P> This one doesn't work P> |
| My System Specs |
| 05-15-2009 | #8 (permalink) |
| | Re: Set home directory with Pipe On May 15, 1:11*pm, Personne <cpdiv...@xxxxxx> wrote: Quote: > As I've said in my 12:15 message > > Get-qaduser UserName | *Set-QADUser -HomeDirectory "\\SBS02\Userdata\$ > ($_.logonname)" -HomeDrive "H" > > This one doesn't work Sorry, the way the line broke I didn't notice the first $. Shay's answer is what I would recommend. |
| My System Specs |
| 05-16-2009 | #9 (permalink) |
| | Re: Set home directory with Pipe Is there a powershell command, to change the way the line are break in google newsgroup ? :-) |
| My System Specs |
| Thread Tools | |
| |
| Similar topics to: Set home directory with Pipe | ||||
| Thread | Forum | |||
| home directory replacement | PowerShell | |||
| Pipe a pipe command to a file | VB Script | |||
| Vista Home in Active Directory | Vista General | |||
| User Home Directory | PowerShell | |||
| How do I rename the Admin home directory? | Vista account administration | |||