gnuchu
gnuchu

Reputation: 1496

Powershell accessing network files on windows

Hopefully a simple one.

If I run powershell on my XP machine and run:

PS> get-childitem \\networkdrive\$share\folder\file.ext

the command successfully completes and returns the information I am looking for.

If I run the same command from team city it error with an Object-Not-Found. (The team city server and agent are running on the same machine that succeeds with the command)

I'm presuming that this is because Windows Services (what the agent is running as) cannot access network drives.

Does anyone have a simple workaround for this?

Upvotes: 0

Views: 2299

Answers (1)

larsro
larsro

Reputation: 76

The problem is not that team city is running as an Windows Service. The problem is that the account used for that service do not have access to the network share.

There are two solutions to the problem:

1) Change the account of the service to an account which have access to the network share.

  • Open Services-> Find the team city services
  • Right click-> Properties -> Go to the Log On tab
  • Put in the name and password of an account with access

2) Grant the currently used account (most likely the Network Service Account) access to the share.

  • Use the above steps to figure out which account Team City is running under
  • On the share Grant access to that account
  • If it is the Network Service or System account, you need to add the Computer as an account instead of a user. So make sure you pick Computer as object type in the Add dialog.

Upvotes: 1

Related Questions