New
#91
Yes that works..
Connected from Lenovo2..
got Video K: drive/folders/files.
Still get No access on others.
Yes that works..
Connected from Lenovo2..
got Video K: drive/folders/files.
Still get No access on others.
The Network group works. Let's apply it to all drives now, while stripping HomeUsers from them.
Place the following script in the same directory as the "shares-list.csv" file and run. After it's done, test your access to your shares.
set_ntfs_permissions_2.bat
Code:@echo off setlocal EnableDelayedExpansion REM Set NTFS permissions on share paths set "shares_csv=%~dp0\shares-list.csv" goto :main :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 50 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 for /f "skip=1 delims=" %%I in ('type "%SHARES_CSV%"') do ( for /f "usebackq tokens=1,2,3 delims=," %%J in ('%%I') do ( set "locations=!LOCATIONS!,%%~K" ) ) for %%I in (%LOCATIONS%) do ( set "location=%%~I" icacls "!LOCATION:\=/!" /grant:r "Network:(OI)(CI)(F)" /c ) REM remove the HomeUsers group from each %LOCATIONS%: for %%I in (%LOCATIONS%) do ( set "location=%%~I" icacls "!LOCATION:\=/!" /remove "HomeUsers" /c ) echo.& echo Done.& echo.& echo Press any key to exit...& pause >NUL
OKay running now
9:50pm Down to L:/ some time to go yet...
Last edited by ozstar; 16 Sep 2015 at 06:51. Reason: 9:50pm update on script running
Hmm, I just noticed something and I wonder if it was part of the problem we had earlier with correct credentials not granting access. Bah, we may have lost the time over nothing
- When you were accessing Webmain from Lenovo with password protection off, the open session was Guest (you know this by now)
- After turning on password protection, you got asked for credentials (which we wanted)
- But since the session was still open on Lenovo (even if you close the session on Webmain), Lenovo was trying to use the open session even if you entered correct credentials
- Restarting/relogging or running this command ("net use * /del" ) would correct the issue (need to close session on both PCs). Command may be deleting drive/folder maps though. (Ok, checked and mapped folders were unaffected)
I was testing with password protected sharing off, and after turning it on, I wasn't granted access with my admin account. First I tried closing the session on my "Webmain" and it still didn't grant access. Then it hit me to delete the connections on my "Lenovo" :)
Last edited by GokAy; 16 Sep 2015 at 17:07.
Then, I assume it worked! That's right, the last time I did not reboot both Lenovo2 and Webmain.
The script is still running and from where it's at now L:\ second time around, I think a few hours to go through the 2 ext 2TB drives.
It sure has been a marathon !
I love working with scripts though lost touch with it now. Reminds me of my time at it before Windows 30/40 years ago. The guys with Linux are still living it although that too is changing. Linux Mint 17 is a good example.
My son is an Analyst using mainly Net but also the C family and others.
Anyway, just a bit of banter to loosen up this morning !
Good morning by the way :) Will head to bed myself in an hour or so. I guess I won't be up to see the result tonight.
Must be late there ! Nice sunny day here with a cool breeze!!
Yes hopefully it won't be too long, although it may take another few hours to complete.
It is still blinking away on L:\ and has been for a few hours.
Can't thank you guys enough for your help. I remember I used to have weird things happen with Win 95 and 98, then Xp came along..
Enjoy your sleep..
Update: Still at L:\ blinking however can access all drives/folders/files on Webmain from all boxes. Great news..
Okay Done !
All drive/folders and files are accessible
Woo Hoo...