Page 1 of 1
Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 06:41
by SIMMS7400
Hi Folks -
I'm running into an issue where when I try to map a SharePoint URL to a drive letter using net use via batch script, I'm getting the following error:
Code: Select all
System error 1244 has occurred.
The operation being requested was not performed because the user has not been authenticated.
This happens when I supply the /USER: switch. However, it I use net use without, and I'm promoted to enter username and password, it works fine.
Does anyone have any ideas why?
Thanks!
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 07:20
by Squashman
Making assumptions here.
1) Since you did not show any code I am going to assume you are using the NET USE command correctly.
2) I don't have share point to test with, but I would assume that if you are supplying the /USER option you will also have to supply the password with the NET USE command.
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 10:04
by SIMMS7400
Hi Squash -
I can confirm i'm using NET USE correctly as well as supplying the password to /USER:
Code: Select all
SET "CREDS=MPI\DonaldTrump MAGA"
SET "HORIZON_URL_STG=https://horizon.tttt.com/sites/rdfinance/TM1/DATA/Ascend_Headcount/Ascend_Headcount_Staging"
FOR %%D IN ( b d e f g h i j k l m n o p q r s t u v w x y z ) DO (
IF NOT EXIST %%D:\ (
SET "MD=%%D"
NET USE !MD!: "%HORIZON_URL_STG%" /USER:%CREDS%
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 10:08
by Squashman
I don't see Delayed Expansion Enabled nor is there any need to use delayed expansion. Just use the FOR variable with the NET USE command.
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 10:40
by Compo
Why use a devicename? does using NET USE * not map the next unused drive letter anyway?
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 10:43
by SIMMS7400
Hi Gents -
Yes, delayed expansion was at the top of my script - I cut it down to post here but forgot that piece.
Compo - yes however I need to preserve tat drive letter so I can delete that specific drive upon script exit.
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 07 Sep 2017 11:08
by Squashman
Just from reading a few articles online it looks like you need to do some upfront settings in Internet Explorer to make it a trusted site and have it remember the credentials.
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 08 Sep 2017 11:30
by ShadowThief
Can you pushd to the folder instead?
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 08 Sep 2017 13:01
by SIMMS7400
Hi Folks -
Shadow - I'm going to try that now.
Edit : 303pm - PUSHD doesn't seem like it works with URLs
Also and update : Sometimes the mapping works, other times it does not. It's really frustrating and I cant identify a constant to help me figure out why sometimes it works while other times it doesn't.
I'll report back.
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 08 Sep 2017 16:50
by SIMMS7400
Whats interesting is that if I use the net use command without the /user switch so I can provide my username and password manually, the second piece of the mapping script will map fine, automatically with the /user switch...
Code: Select all
FOR %%D IN ( b d e f g h i j k l m n o p q r s t u v w x y z ) DO (
IF NOT EXIST %%D:\ (
SET "MD=%%D"
NET USE !MD!: "%HORIZON_URL_STG%" && (
ECHO Success : Map Horizon Stage URL >>"%LOGFILE%"
ECHO %HORIZON_URL_STG% >>"%LOGFILE%"
ECHO.>>"%LOGFILE%"
CALL :CHCK_MD
) || (
ECHO Failed : Map Horizon Stage URL >>"%LOGFILE%"
ECHO %HORIZON_URL_STG% >>"%LOGFILE%"
ECHO.>>"%LOGFILE%"
SET "NF1=1"& GOTO AbnormalExit
)
FOR %%E IN ( b d e f g h i j k l m n o p q r s t u v w x y z ) DO (
IF NOT EXIST %%E:\ (
SET "MD1=%%E"
NET USE !MD1!: "%HORIZON_URL_IMP%" /USER:%CREDS% >nul 2>&1 && (
ECHO Success : Map Horizon Import URL >>"%LOGFILE%"
ECHO %HORIZON_URL_IMP% >>"%LOGFILE%"
ECHO.>>"%LOGFILE%"
GOTO BREAK
) || (
ECHO Failed : Map Horizon Import URL >>"%LOGFILE%"
ECHO %HORIZON_URL_IMP% >>"%LOGFILE%"
ECHO.>>"%LOGFILE%"
SET "NF1=1"& GOTO AbnormalExit
)
)
)
)
)
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 08 Sep 2017 19:05
by ShadowThief
Sorry, I was posting from my phone earlier. You can't pushd web URLs, but you can pushd network folder paths. It may be different for you, but it will look something like
Code: Select all
pushd \\horizon.tttt.com\sites\rdfinance\TM1\DATA\Ascend_Headcount\Ascend_Headcount_Staging
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 09 Sep 2017 06:09
by SIMMS7400
Hi Shadow -
Thanks for that clarification - I figured as much.
So I tried a few things:
Code: Select all
Runas /user:MPI\ServiceHyperion "\\horizon.tttt.com\sites\rdfinance\TM1\DATA\Ascend_Headcount\Ascend_Headcount_Staging"
But this gives me a "Trust relationship between this workstation error"
Code: Select all
PUSHD "\\horizon.tttt.com\sites\rdfinance\TM1\DATA\Ascend_Headcount\Ascend_Headcount_Staging"
This method gives me an "Access denied error". Is there a way to pass credentials to pushd?
Re: Mapping intranet SharePoint URL - System 1244 Error
Posted: 09 Sep 2017 07:27
by ShadowThief
Oh, if you need to provide credentials pushd can't do that