Link to home
Start Free TrialLog in
Avatar of cwstad2
cwstad2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Script not running correctly

Hi all, i have the following script that interrogates the .txt file for the computer names and create a c:\utils folder on each. I think im almost there. any suggestions. Thanks

$servers =Get-Content "C:\server.txt"

foreach ( $servers1 in $servers ) {

@"

Displaying for $servers1

"@


 $copy = New-Item -ItemType directory -Path  "\\$servers1\c$\utils"

 }
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

this assumes the utils directory already exists.

 "\\$servers1\c$\utils"

is New-Item the utils locally?  If you're copyign the whole directory wouldn't it just be "\\$servers1\c$\"?
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cwstad2

ASKER

Almost there. Thanks for your help