Fix permissions on user .v2 profiles folders

Fix permissions on user share or profiles folders

The following script is similar to a script that I created back in Windows 2000 server days.  I have misplaced that script (probably still being used at the last place I worked).  I did a search and found a better version of my script by leaps and bounds.  The following was copied URL: http://wiki.mundy.co/Fix_permissions_on_user_share_or_profiles_folders

This script fixes the permissions of a single user profile folder. Save the following script as fixpermissions.bat in the base of your profiles directory:

REM get the username
set tempuser=%1
set username=%tempuser:.v2=%
REM Recursively assign ownership to Administrators.  Answer prompts with "Y". 
takeown /R /A /F %1 /D Y 
REM Grant Full permissions on folder and subfolders to Administrators, SYSTEM, and the user 
cacls %1 /T /E /P "Administrators":F 
cacls %1 /T /E /P SYSTEM:F 
cacls %1 /T /E /P %username%:F 
REM Set owner back to UserName 
rem subinacl.exe /noverbose /subdirectories %1\*.* /setowner=%username%

Run it from the base profiles directory. e.g. if the profile is in E:\Profiles\DanMundy then do the following commands:

e:
cd Profiles
fixpermissions.bat DanMundy

Instead of having to do it manually for each user, you can use the following script to fix the permissions for all users profiles folder. Save the following script as fixall.bat in the same directory as the fixpermissions.bat script:

for /f "delims=" %%i in ('dir /ad/b') do fixpermissions.bat %%i

Run it from the base profiles directory like this:

e:
cd Profiles
fixall.bat

Start and Stop script for exchange 2010

Stop exchange – 

net stop msexchangeadtopology /y
net stop msexchangefba /y
net stop msftesql-exchange /y
net stop msexchangeis /y
net stop msexchangesa /y
net stop iisadmin /y
net stop w3svc /y

Start Exchange –

net start msexchangeadtopology /y
net start msexchangefba /y
net start msftesql-exchange /y
net start msexchangeis /y
net start msexchangesa /y
net start iisadmin /y
net start w3svc /y

Start Automatic Services That Have Stopped

Start Automatic Services That Have Stopped

Source: Lazynetworkadmin.com//

//

script will run as a scheduled task after the servers startup

//

//

‘This script will check a server and make sure all Automatic services are Started
On Error Resume Next

strComputer = “.”

i = 0

intLongSleep = 600000

intShortSleep = 60000

WScript.Sleep intLongSleep

Set objWMIService = GetObject(“winmgmts:” _

& “{impersonationLevel=impersonate}!” & strComputer & “rootcimv2”)

Set colRunningServices = objWMIService.ExecQuery(“Select * from Win32_Service”)

For Each objService in colRunningServices

‘WScript.Echo objService.Name  & VbTab & objService.StartMode & objService.Started

If objService.StartMode = “Auto” Then

‘WScript.Echo “Found Mode”

Redim Preserve arrStartMode(i)

arrStartMode(i) = objService.Name

i = i + 1

Start = LBound(arrStartMode)

sEnd = UBound(arrStartMode)

‘WScript.Echo objService.Name & VbTab & objService.StartMode & ”  ” & objService.Started

StartSVC()

Else

End If

Next

Function StartSVC()

If objService.Started = False Then

‘WScript.Echo objService.Name & VbTab & objService.StartMode & ”  ” & objService.Started

objService.StartService()

WScript.Sleep intShortSleep

End If

End Function

—–Copy everything above this line—–