i have the script as

5..12 | foreach-object { import-csv "\\servername\staffdata\IT\Login Accounts\2011\AD\Year$_.csv" } | ForEach-Object { Enable-Mailbox $_.email -Database "Student Mailbox Store" }

and i have a csv named Year5_2.csv in the correct folder. I am getting the following error

Import-Csv : Cannot open file "\servername\staffdata\IT\Login Accounts\2011\AD\Year5.csv". At line:1 char:36

Any suggestions please

link|improve this question

disregard i was using the wrong file. – JohnyV Jan 21 '11 at 7:19
feedback

closed as not a real question by Evan Anderson, Sam, SvenW, Iain, sysadmin1138 Jan 21 '11 at 23:47

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. See the FAQ for guidance on how to improve it.

1 Answer

If the file name is Year5_2.csv than you should use syntax similar to: Import-Csv "\servername\staffdata\IT\Login Accounts\2011\AD\Year$_`_2.csv"

$_ = 5..12 if 2 is also variable than you need to tweak it a bit. HTH Bartek

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.