function deleteold($apath) {
$items = get-childitem $apath -force
foreach($fileordir in $items) {
if($fileordir.PSIsContainer) {
deleteold($fileordir.FullName)
} else {
$adate = get-date
$adate = $adate.adddays(-10)
if($fileordir.LastWriteTime -lt $adate){
Today is: 8 February, 2010
Powershell function to delete files by date
Powershell function to remove empty directories
I created the following recursive function to delete empty directories. I made it recursive instead of using the built-in recursive argument because I was working with large file system, and the file and directory "counting" that the recursive flag does was a bit cumbersom. The force flag on the get-childitem cmdlet will cause the cmdlet to discover hidden files.
Allow X Forwarding over SSH while using sudo
If you want to sudo, but then allow X Forwarding over SSH, I've found the easiest way is to copy the xauth information from the logged in user to root.
For example:
ZCM10 - Manually removing a primary server
This process should remove a defunct primary server from the ZENWorks Configuration Management database if an uninstall is unsuccesful or a server fails/crashes.
Installing Cisco VPN on Linux
I got the client and patch from here. I used the 4.8.01.0640-k9 version with the 2.6.24-final patch. I have tested it on Ubuntu 8.10.
The installation is very easy.
Fixing the HTML Browser in Notes 8 for Linux
Notes v8 and v8.0.1 (native) for Linux both use the Mozilla rendering engine. However, it looks for a fairly old version of xulrunner, specifically version 1.9 beta 5. To fix this:
Updating the "Favorites" in the KDE4 Start Menu (Kickoff)
In KDE4, the file which stores all the preferences is:
~/.kde4/share/config/kickoffrc
On OpenSuSE 10.3/11 which uses the KDE4 Start menu, the file is at:
~/.kde/share/config/kickerrc
Using Checkpoint's SNX on Linux
These are the appropriate steps for Fedora 9, OpenSuSE 10.3 and OpenSuSE 11.0. More distributions probably follow.
I'm assuming that you, or someone at your organization, has set up the Checkpoint SNX webpage. Visit that page in Linux with a Java enabled webbrowser. After you login, you will be prompted in a pop-up terminal window to enter the root password. However, after you've done this, the window will just close.
Installing the Novell Client for Linux on OpenSuSE 11.
There are two changing factors in every release of OpenSuSE which precipitate slight modifications before installing the client. One, is the novfs kernel module and the other is the version of binutils that the xtier base was compiled against.
- Download the Novell Client from http://download.novell.com (I'm using the SLE10-SP1 version in the instructions below)
Adding rights to a file or folder with PowerShell
Pretty straight forward example and reference for adding rights to a folder or file with PowerShell.
Example
$AccessControl = get-acl "D:\My Documents"
$AccessRule = New-Object Security.AccessControl.FileSystemAccessRule("Users", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")
$AccessControl.AddAccessRule($AccessRule) set-acl -aclobject
$AccessControl -path "D:\My Documents"