Friday, November 6, 2009
BackupExec on Linux : /opt/VRTSralus/bin/beremote daemon stops unexpectedly
A workaround consists in checking every hour (in this example) if the agent daemon (/opt/VRTSralus/bin/beremote) is still running, and if stopped, restart it.
Create the following script file (/root/restartRalus.sh) :
if [ -f /bin/grep ]
then
PID=`/bin/ps -e | /bin/grep beremote | /bin/sed -e 's/^ *//' -e 's/ .*//'`
else
PID=`/usr/bin/ps -e | /usr/bin/grep beremote | /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
fi
if [ "${PID}" = "" ]
then
/etc/init.d/VRTSralus.init start
fi
And execute it every hour for example :
> crontab -e
> 0 * * * * sh /root/restartRalus.sh
Thursday, November 5, 2009
VB Script to get folder and subfolders sizes with treedepth...
Create a FolderList.txt file with pathes to folders you want to scan (don't leave blank lines)
Set the values you want for :
isProcessFiles : Get files size too
treeDepth : tree depth when scanning folders
computeAllFoldersSize : compute full size of all folders
Const isProcessFiles = 1
Const treeDepth = 3
Const computeAllFoldersSize = 1
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.CreateTextFile(".\FolderSizes.log")
if computeAllFoldersSize = 1 then
fullSize = 0
Set objTextFile = objFSO.OpenTextFile(".\FolderList.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strFolderPath = objTextFile.Readline
Set objFolder = objFSO.GetFolder(strFolderPath)
fullSize = fullSize + objFolder.size
Loop
objLogFile.Writeline "Size of all folders in list file : " & FormatNumber(fullSize/(1024*1024*1024),3) & " GB"
objLogFile.Writeline ""
objTextFile.Close
End If
if treeDepth < 1 then wscript.quit
'For all folders specified in the text file
Set objTextFile = objFSO.OpenTextFile(".\FolderList.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strFolderPath = objTextFile.Readline
Set objFolder = objFSO.GetFolder(strFolderPath)
ProcessFolder (objFolder)
Loop
Sub ProcessFolder(objCurrentFolder)
objLogFile.Writeline FormatNumber(objCurrentFolder.Size/(1024*1024),0) & " MB " & objCurrentFolder.path
if treeDepth > 1 then Call ProcessSubFolders (objCurrentFolder, 1)
End Sub
Sub ProcessSubFolders(ByRef objCurrentFolder, ByVal currentRecurseLevel)
if currentRecurseLevel >= treeDepth then exit Sub
recurseTabs = ""
For value = 0 To currentRecurseLevel - 1
recurseTabs = recurseTabs & " "
Next
if objCurrentFolder.SubFolders.count = 0 then
if isProcessFiles = 1 then
Call ProcessFiles (objCurrentFolder, currentRecurseLevel)
end if
else
Call ProcessFiles (objCurrentFolder, currentRecurseLevel)
For Each objCurrentSubFolder In objCurrentFolder.SubFolders
objLogFile.Writeline recurseTabs & FormatNumber(objCurrentSubFolder.Size/(1024*1024),0) & " MB " & objCurrentSubFolder.path
Call ProcessSubFolders (objCurrentSubFolder, currentRecurseLevel + 1)
Next
end if
End Sub
Sub ProcessFiles (ByRef objCurrentFolder, ByVal currentRecurseLevel)
if currentRecurseLevel >= treeDepth then exit Sub
recurseTabs = ""
For value = 0 To currentRecurseLevel - 1
recurseTabs = recurseTabs & " "
Next
For Each objCurrentFile In objCurrentFolder.Files
objLogFile.Writeline recurseTabs & FormatNumber(objCurrentFile.Size/(1024*1024),0) & " MB " & objCurrentFile.path
Next
End Sub
Friday, October 30, 2009
Windows Explorer very slow when browsing SharePoint Libraries
This problem has been popping up sporadically over the past number of months and I was unable to pin it to a particular client or server version. I’ve seen it in Vista and Windows 7 clients and also on MOSS 2007 with SP1 and with SP2.
When opening a SharePoint library using the Windows Explorer, the user had to wait anything between 5 and 30 seconds for a reaction – opening documents caused the same delay. It was impossible to use effectively.
I still haven’t worked out exactly how this setting is related, but changing it seems to have done the trick. Under “Internet Options”-“Connections”-“LAN settings” I disabled the checkbox “Automatically detect settings” (see below). Even though this was not effecting all users, I pushed this setting out in a GPO – so far so good.
Windows Explorer must have been looking for configuration settings every time the user clicked on a folder
Resizing Samsung hard drives to fit controller size limits
To resize your disk use the SET MAX ADDRESS feature. After resizing, you will be able to use them with size limited controllers (of course you can restore the initial size if needed).
Wednesday, October 28, 2009
Delay SAN shutdown on power outage, avoid corrupt databases...
My hardware : Dell EMC AX150 + APC Smart UPS 750
You cannot delay this shutdown through the NaviSphere software.
This is really annoying since the SAN hosts the Exchange databases (could have been SQL databases too).
When there is a power outage, the Exchange server doesn't have time to shutdown before the SAN turns off.... and this can cause database or logs corrupt...
In order to avoid this and since there is nothing I can parameter, I have added an intermediate UPS as shown below :

So my servers (connected to another UPS) can shutdown on a power outage (please read the shutdown scripts article) and then once the intermediate UPS battery is low (or you can parameter a delay too) it behaves like a power outage for the SAN+UPS and this one turns off too.
Wednesday, October 21, 2009
Forefront : enable FCS client to change settings
I thought that enabling the "Only administrators can change Client Security agent settings" would work as each user is in the administrator group of his machine.

This doesn't work unless you change the protection settings (virus/spyware protection) and set them to User controlled :

This will allow users to set their own schedule.
If you want to set the default scheduled scan (everyday 2AM) to another value, change it while Virus protection is set to on and before changing it to User controlled.
Monday, October 19, 2009
UPS Scripts/Procedure : Shutdown a Linux server from Windows.
- On your Windows server running PowerChute, create a folder (eg. C:\ShutdownScripts) and copy in it plink and puttygen that you can download here
Puttygen will create ssh keys, and plink will execute a command on a remote machine using an ssh connection. - Run puttygen and create a pair of ssh keys (public/private) using SSH-2 DSA / 1024 in the same folder. You will generate two files, sshkey.pub and sshkey.ppk.
- Create a batch file locally (shutdownLinuxServers.bat) and add commands like :
cd C:\ShutdownScripts
@plink -T powerchute@mylinuxserver1 -i sshkey.ppk sudo /sbin/shutdown -h -P now
@plink -T powerchute@mylinuxserver2 -i sshkey.ppk sudo /sbin/shutdown -h -P now
....
This will ssh to your linux servers with the powerchute account to halt and shut them down . - On the linux server(s) side, you will need to create a user account able to shutdown the server.
- Create the powerchute account :
useradd -m -d /home/powerchute -g users -s /bin/bash powerchute - In the home folder of the user powerchute (/home/powerchute), create a subfolder .ssh (rights 700), and add it a blank file called authorized_keys (touch authorized_keys) (rights 644)
- Copy the content of your sshkey.pub in the file authorized_keys
- Append this command at the end of authorized_key, after the public key :
from=myWindowsServer,command=sudo /sbin/shutdown -h -P now ssh-dss
Where myWindowsServer is the DNS name or IP of your server running APC PowerChute.
Your file authorized_key should look like this :
ssh-dss AAAB3NzaC1kc3MAAACBAOEIj5Hm0ByaNObfUPhpboS0fONW9WqATYXjGi/wlmJipxBNo+//WooNdfeMN9bCqlbT7Z0eXfL+r4Xdmqp........svjduAB2mbQ== dsa-key-20091009 from=192.168.192.50,command=sudo /sbin/shutdown -h -P now ssh-dss - Edit the sudoers file :
> visudo - Search for this block and comment the last line :
# Defaults specification
#
# Disable "ssh hostname sudo", because it will show the password in clear.
# You have to run "ssh -t hostname sudo".
#
# Defaults requiretty <-- commented - Search for this block and add the last line :
# User privilege specification
root ALL=(ALL) ALL
powerchute ALL = NOPASSWD: /sbin/shutdown - On your Windows server, add C:\ShutdownScripts\shutdownLinuxServers.bat to your APC PowerChute script (C:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles\default.cmd)
Monday, October 12, 2009
APC PowerChute script for Windows servers
On the PowerChute web page, select the events you want to run a script from.
Add the default.cmd (C:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles\default.cmd) command file.

The default.cmd contains after a fresh install :
@echo off
rem
rem Maximize for best viewing
rem This command file provides examples of proper command file syntax
rem
rem Command Files run by PowerChute Business Edition must be placed in this directory.
rem
rem Use the full path name of executable programs and external command files.
rem
rem The @START command must be used to run executable programs (see example below).
rem For the @START command, path names that include spaces must be enclosed in quotes;
rem arguments for the executable must be outside the quotes. A double quote must
rem precede the quoted path name. For example, to execute a command file in
rem c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles called myShut.exe,
rem the following line should be entered in the command file:
rem
rem @START "" "c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles\myShut.exe"
rem
@echo on
Add some new commands at the end like :
@START "" "C:\WINDOWS\system32\shutdown.exe" /s /f /m \\myserver.mydomain.intra /c "APC Shutdown" /d 6:12
This will shutdown your server remotely, closing all open applications and with a warning message.
You can add other commands or batch too.
IMPORTANT : the powerchute agent service may not run with sufficiant privilieges, so it cannot execute a shutdown on a remote server. Usually it uses a local account.
You need to change it to use an AD admin account :
Wednesday, October 7, 2009
Prevent domain users to add computers to domain
If you want to prevent domain users to add machines to the domain, you cannot do it by GPO, since the only policy existing "Add workstation to domain" applies to Computers Configuration and not User Configuration.
You have to run ADSI edit from the administrative tools, roll down Default Naming Context, right click on your DC=mydomain, then properties :
Find the value MS-DS-Machine-Account-Quota and change it to 0 (10 is the default value).
Monday, October 5, 2009
“Access is denied” error when crawling content with SharePoint or browsing local server
When crawling your local SharePoint site you may receive the following error message:
Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content. (The item was deleted because it was either not found or the crawler was denied access to it.)
This can happen even if the account has the necessary permissions to crawl the site. This error is caused by what is know as the “loopback check”. The loopback check is basically a security “feature” which won’t allow a local IIS website to be accessed using a FQDN. This prevents an attack from pretending to be local thus bypassing certain restrictions.
Unfortunately, it also prevents your crawler from accessing local sites if they are using a FQDN.
Microsoft offers two workarounds here. You can either turn off this behaviour completely (not recommended) or you can exclude your site from this check. Here is method 2 from the above link:
- Set the DisableStrictNameChecking registry entry to 1.
- Locate and click the following key in the registry:
- On the Edit menu, click Add Value, and then add the following registry value:
Value name: DisableStrictNameChecking
Data type: REG_DWORD
Radix: Decimal
Value: 1 - In Registry Editor, locate and then click the following registry key:
-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
- Right-click MSV1_0, point to New, and then click Multi-String Value.
- Type BackConnectionHostNames, and then press ENTER.
- Right-click BackConnectionHostNames, and then click Modify.
- In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
- Quit Registry Editor, and then restart the IISAdmin service.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters