Windows Server - Getting ERROR_ACCESS_DENIED when i am using NetDfsAddStdRoot.

Asked By RAVI KUMAR on 21-Mar-12 12:45 AM
Hi ,
I  had developed a simple program in win 7 32 bit(client) , to create a DFS Share in winserver2003.The RootShare is present in the server, but i am getting an error ERROR_ACCESS_DENIED , could any one can slove this issue, the code is :


#include<iostream>
using namespace std;
  
#include<conio.h>
  
#include <windows.h>
#include <lm.h>
#include <lmdfs.h>
#include <stdio.h>
#pragma comment(lib, "NetApi32.lib")
  
void main()
{
  DWORD res=0;
LPWSTR ServerName=L"\\\\WINSRV2003_32";
LPWSTR RootShare=L"\\fshare";
  
res =NetDfsAddStdRoot(ServerName,RootShare,NULL,0);
if(res==NERR_Success)
{
  cout<<"Function succeeds"<<endl;
}
else
{
cout<<" Not Function succeeds"<<endl;
}
getch();
}
D Company replied to RAVI KUMAR on 21-Mar-12 09:48 AM
this article has helpful information, and detail description of the error
http://msdn.microsoft.com/en-us/library/windows/desktop/bb525388(v=vs.85).aspx

Regards
D