Hi guys,
Are bad permissions still a suspect?
It's probably a good time to check that your Share and NTFS permissions are not the culprit to your inability to access your shares, Ozstar. Unfortunately Windows 7 does not come with PowerShell 3.0 by default, so for us to see the relevant permissions, I'll need you to run a batch file that collects some information about your shares for us so that we can examine your permissions first hand and not just take your work for it.
Run the below batch script on the machine that's hosting the Share you are having difficulties accessing remotely. The batch script will create a txt file on your desktop. Upload that file or copy-paste it's contents here for us to peruse.
GetShareInfo.bat
Code:
@echo off
setlocal EnableDelayedExpansion
:: Source: https://www.sevenforums.com/network-sharing/380833-help-create-regular-lan-share-drives-folders-not-home-2.html#post3145446
REM This batch file collects the following information:
REM The current machine's OS and version
REM Share information and permissions
REM Share path permissions
REM
REM Limitations:
REM Share details will not be retrieved for Share names that exceed 45 characters.
set "output_file=C:\Users\%USERNAME%\Desktop\ShareDetails.txt"
goto :main
:trim_leading_spaces VariableName
setlocal EnableDelayedExpansion
set "_=!%~1!"
set _=%_:"=%
:trim_leading_spaces__while
if "%_:~0,1%"==" " ( set "_=%_:~1%"& goto :trim_leading_spaces__while)
endlocal & set "%~1=%_%"
goto :eof
:trim_trailing_spaces VariableName
setlocal EnableDelayedExpansion
REM Uses delayed expansion, however, may be slightly quicker than the verion without.
REM Don't use this if the string may contain an exclaimation mark!
set "_=!%~1!"
set _=%_:"=%
:trim_trailing_spaces__while
if "%_:~-1%"==" " ( set "_=%_:~0,-1%"& goto :trim_trailing_spaces__while)
endlocal & set "%~1=%_%"
goto :eof
:PromptUacAndFocus ScriptFullPath
setlocal
set "temp1="%TEMP%\%~nx0_1_%RANDOM%.vbs""
set "temp2="%TEMP%\%~nx0_2_%RANDOM%.vbs""
net sess>NUL 2>&1||goto 2>NUL||(
( echo CreateObject^("Shell.Application"^).ShellExecute "%~1",,,"RunAs",1) > %TEMP1%
(
echo strTmpFile_1 = %TEMP1%
echo strTmpFile_2 = %TEMP2%& echo.
echo Function CountWindowInstance^(strProcessName^)
echo CountWindowInstance = GetObject^("winmgmts:\\.\root\cimv2"^).ExecQuery^("Select * from Win32_Process Where Name = '" ^& strProcessName ^& "'"^).Count
echo End Function& echo.
echo Set WshShell = CreateObject^("WScript.Shell"^)& echo.
echo For I = 0 To 1
echo If CountWindowInstance^("consent.exe"^) ^> 1 Then WScript.Sleep 200 Else WScript.Sleep 75
echo WshShell.AppActivate^("User Account Control"^)
echo Next& echo.
echo On Error Resume Next& echo.
echo With CreateObject^("Scripting.FileSystemObject"^)
echo If .FileExists^(strTmpFile_1^) Then .DeleteFile^(strTmpFile_1^)
echo If .FileExists^(strTmpFile_2^) Then .DeleteFile^(strTmpFile_2^)
echo End With
) > %TEMP2%
for /l %%_ in (1,1,2) do ping >NUL
start WScript %TEMP1%
for /l %%_ in (1,1,2) do ping >NUL
start WScript %TEMP2%
for /l %%_ in (1,1,2) do ping >NUL
exit
)
endlocal
goto :eof
:main
call :PromptUacAndFocus %0
(
echo.& echo ################## Machine info ##################
set/p=Collecting machine info...<NUL >NUL >&2
ver
rem set/p=Computer name: <NUL
rem for /f "skip=1 delims=" %%I in ('wmic os get CSName') do for %%J in (%%I) do ( echo %%J )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName | find "ProductName"
echo Done >NUL >&2
echo.& echo ################## Share overview ##################
net share
echo.& echo ################## Individual Share details ##################& echo.
set/p=Collecting Share info...<NUL >NUL >&2
for /f "skip=4 delims=" %%I in ('net share') do (
if not "%%~I"=="The command completed successfully." (
echo.%%~I| find ":" >NUL && (
for /f "tokens=1 delims=:" %%J in ("%%~I") do ( set "share=%%~J" )
set "share=:!SHARE:~0,-1!"
call :trim_trailing_spaces share
echo !SHARE!| findstr /v "^:$" >NUL && (
net share "!SHARE:~1!"
echo ~~~~~~~~~
)
type NUL
) || (
set "share=%%~I"
set "share=:!SHARE:~0,45!"
call :trim_trailing_spaces share
echo !SHARE!| findstr /v "^:$" >NUL && ( net share "!SHARE:~1!"& echo ~~~~~~~~~)
)
)
)
echo Done >NUL >&2
echo.& echo ################## Local Share path NTFS permissions ##################& echo.
set/p=Collecting Share NTFS permissions info...<NUL >NUL >&2
for /f "skip=4 delims=" %%I in ('net share') do (
if not "%%~I"=="The command completed successfully." (
echo.%%~I| find ":" >NUL && (
for /f "tokens=1 delims=:" %%J in ("%%~I") do ( set "share=%%~J" )
set "share=:!SHARE:~0,-1!"
call :trim_trailing_spaces share
echo !SHARE!| findstr /v "^:$" >NUL && (
for /f "delims=" %%J in ('net share "!SHARE:~1!"') do (
echo.%%~J| findstr "^Path" >NUL && (
set "share_path=%%J"
set "share_path=!SHARE_PATH:~4!"
call :trim_leading_spaces share_path
echo NTFS permissions of '!SHARE_PATH!' of Share '!SHARE:~1!':& echo.
if "!SHARE_PATH:~-1!"=="\" set share_path=!SHARE_PATH:~0,-1!
icacls "!SHARE_PATH!"
echo ~~~~~~~~~
)
)
)
type NUL
) || (
set "share=%%~I"
set "share=:!SHARE:~0,45!"
call :trim_trailing_spaces share
echo !SHARE!| findstr /v "^:$" >NUL && (
for /f "delims=" %%J in ('net share "!SHARE:~1!"') do (
echo.%%~J| findstr "^Path" >NUL && (
set "share_path=%%J"
set "share_path=:!SHARE_PATH:~4!"
call :trim_trailing_spaces share_path
set "share_path=!SHARE_PATH:~1!:"
call :trim_leading_spaces share_path
echo !SHARE_PATH!| findstr /v "^:$" >NUL && (
set "share_path=!SHARE_PATH:~0,-1!"
echo NTFS permissions of '!SHARE_PATH!' of Share '!SHARE:~1!':& echo.
if "!SHARE_PATH:~-1!"=="\" set share_path=!SHARE_PATH:~0,-1!
icacls "!SHARE_PATH!"
type NUL
) || (
echo The path of Share '!SHARE:~1!' could not be resolved.
)
echo ~~~~~~~~~
)
)
)
)
)
)
echo.& echo EOF
) > "%OUTPUT_FILE:"=%"
echo Done >NUL >&2
echo Complete. >NUL >&2
echo.& echo Saved share details to "%OUTPUT_FILE:"=%"
timeout 4
And along with this information, Ozstar, would you be able to answer the following:
- What share are you trying to access and on what machine?
- What user on what machine are you attempting to access the share with?
- And what groups is this user in?