Adam Driscoll
Adam Driscoll

Reputation: 9483

Network Not Available Error when trying to map network drive

I'm calling WNetAddConnection2 during the login process for a 2008R2 box. The action happens right after userinit is run. I'm receiving a 1222 error or Network Not Available. Right after doing this I'm also connecting a couple printers using the AddPrinterConnection function. Both the printers and the network drives are on the same remote machine.

Why do the printer connections work but the network drive connections fail?

Upvotes: 0

Views: 476

Answers (1)

Steve Townsend
Steve Townsend

Reputation: 54138

Could be a timing issue (network startup still in progress while first call is made). Have you tried reversing the order of the calls?

It's also possible that AddPrinterConnection (which blocks) waits for resources to be available whereas the other does not. have you tried connecting all resources using WNetAddConnection2? Maybe that would fail your your printers too.

Can you make all of this processing dependent on verification of network status via Network Location Awareness?

Upvotes: 1

Related Questions