Thursday, 24 April 2014

Batch file - removing files older than x

I needed to remove IIS logs older than a number of days due to the C drive filling up - I found some information on the net with regards forfiles (instead of using Powershell which was my first port of call but due to the server running Windows 2003).

The script removes files older than 3 days and outputs the errors to a log file (or should - nothing in my log file at present but I've had no errors to date!).

forfiles /p C:\WINDOWS\system32\LogFiles\W3SVC100\ /s /m *.* /d -3 /c "cmd /c del @path" >> C:\Temp\remove_file_log.txt

Wednesday, 2 April 2014

SCCM 2007 - Remote Tools prompt for credentials



Issue where you are prompted for credentials after starting Remote Tools and your account has the appropriate permissions.

Usually indicates that the SCCM client isn’t installed correctly.

1    Uninstall client from the machine – choose the appropriate method at the time. RDP, PSEXEC, etc.
a.        Go to Windows\ccmsetup folder.
b.       Run ‘ccmsetup /uninstall’
2    From the SCCM Console – Computer Management > Collections > All Systems.
a.        Search for machine.
b.       Right-click on the machine name and choose ‘Install Client’.

      Check the log to see if the changes have taken affect: C:\Windows\ccmsetup\ccmsetup.log

NOTE: To read the log properly you will need to use SMS Trace.

Using PSEXEC for a remote command prompt:
C:\PSTools> psexec.exe \\<remote-machine-name> cmd.exe

Links: