web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

"Unknown user name or bad password" while getting files from another server

(0) ShareShare
ReportReport
Posted on by 573

I am trying running batch to get files from a folder in another server, and get the error "unknown user name or bad password". 

The file server does not belong to any domain, and I share the folder to anyone with full control. When the batch class runs from client, it does work. However, it fails when running as batch.

Does anyone give me some advice?

The codes are as below:

permission = new InteropPermission(InteropKind::ClrInterop);
permission.assert();

directory = new System.IO.DirectoryInfo(_path); // Error occurs here.
files = directory.GetFiles(#AllFilesName + #txt);
counter = files.get_Length();
for (idx = 0; idx < counter; idx++)
{

......

}
CodeAccessPermission::revertAssert();

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi bernardqin,

    Check that AOS user has access to that computer

  • bernardqin Profile Picture
    573 on at

    Hi ievgen,

    Thank you for your reply. The AOS user is NETWORK SERVICE, and I add this user to file server with full control, but the error is still there.

  • Mea_ Profile Picture
    60,284 on at

    Hi bernardqin,

    First of all, you should not use NETWORK SERVICE as AOS account, please refer to technet technet.microsoft.com/.../dd362055.aspx

    You said that you granted access to network service account but you should grant access to computer "MYDOMAIN\MachineA$" where MYDOMAIN is AOS domain and MachineA is AOS server name. Please refer for details http://serverfault.com/questions/41130/network-service-account-accessing-a-folder-share

  • Brandon Wiese Profile Picture
    17,788 on at

    If the file server is not part of any domain, then you won't be able to grant permissions for the machine account of a machine on a domain, or even whatever domain account you use for the AOS service.  You'll probably have to use some type of account/password matching, or join that file server to the domain, to get it to work.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans