Posts

Showing posts from May, 2007

Script: Retrieving Free Disk Space

Flash Tip: Illustrated Script - Retrieving Free Disk Space

Q: How do I retrieve free disk space from drive C?

A: The script below illustrates the importance of Automation objects within Microsoft Visual Basic Scripting Edition (VBScript). If you have been having problems with users filling up drive C on their computers, you can use the three-line script below to find out how much free disk space is available on drive C of a computer.

Set objWMIService = GetObject("winmgmts:")
Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='c:'")
Wscript.Echo objLogicalDisk.FreeSpace

You now have a custom solution for identifying the computers running low on disk space, a solution developed using very little VBScript code. Instead, the script:
1.
Connects to Windows Management Instrumentation (WMI), an Automation object, by using the VBScript GetObject method.
2.
Uses the WMI Get method to retrieve information about drive C.
3.
Uses the Windows Script Host (WSH) Echo…

How to Join Vista machine in NT domain

1. SRVMGR.EXE on the PDC and add the computer name of the Vista PC.

2. On Vista PC run, secpol.msc then Under Local Policies > Security Options, Change the following two settings"

- Domain Member: Digitally Encrypt sign secure channel data (always) - change to disabled
- Network Security: LAN Manager authentication level - change to "Send LM and NTLM - use NTLMv2 session security if negoitated"

Extract User list from AD

Use Joe Richard's ADFind at http://www.joeware.net

adfind -gc -b -f "&(objectclass=user)(ObjectCategory=person)(whenCreated>=20070101000000.0Z)(whenCreated<=20070525235959.0Z)" createTimeStamp

Way to list specific folder size and send it on email as a txt attachment

I used DirUse with a batch file as follows:

**************************************************************************************
diruse /s /k /q:50 \\ComputerName\c$\test > c:\data.txt
commail -host=ExchangeServer.DomainName.com -from=EmailAddress@DomainName.com-to=EmailAddress@DomainName.com -subject=FolderSize -msg=c:\data.txt

**************************************************************************************
That worked Great.

commail is what I use to send email. If you need it, email me.

RoboCopy GUI: Good tool to copy files accross servers

This bat file can be use to create folders on multiple servers at a time

On Error Resume Next
Computers = Array("Servername1","Servername2",......)
For Each Computer In Computers
Set objWMIService = GetObject _
("winmgmts:\\" & Computer & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create _
("cmd.exe /c md c:\Foldername", Null, Null, intProcessID)
Next