Published March 1st, 2010
in Uncategorized.
New powershell script. Goes to user home directory on remote server and dumps the folder names to a file. Then, goes through each line in that file and queries AD to make sure the user still exists and outputs it to the console. Not finished yet. Previous admins weren’t keeping up with deleting the home diretories as users left the company. Now I have to be able to add the list of file servers with home directories. meh!
Clear-Host
Get-ChildItem -path \\server\path | select-object name | Out-File c:\usernames.txt
$sname = (Get-Content c:\usernames.txt) -replace ‘ {2,}’,'’
Foreach ($name in $sname)
{
$result = Get-QADUser -SamAccountName $name -ov outvar | Out-Null
if ($outvar -ne $null)
{}
else
{Write-Host $name}
}Edit
Published June 17th, 2009
in Uncategorized.
$DataFolder = “c:\scandocs”
$2Days = (get-Date).adddays(-2)
Get-Childitem $DataFolder -recurse | ?{!$_.PSIsContainer -and ($_.LastWriteTime -lt (get-Date).adddays(-2))} | remove-item -whatif -force
Published September 26th, 2008
in Uncategorized.
I started looking around and found this script to email via vbscript. Later I’ll include different things you can email yourself if you’re an system administrator.
Continue reading ‘Email VBScript’
Published September 24th, 2008
in Uncategorized.
This script will connect to a computer remotely and get the updates installed along with date and domain info. I haven’t formatted the script correctly for display on the web so you might have to do some editing. The script will put the info in a csv file. This script was written with help from others on the net along with MS documentation. I know it needs more commenting but I’m really lazy, Sorry.
Continue reading ‘Inventory Installed MS Updates’
Published September 23rd, 2008
in Uncategorized.
This script will connect remotely to computers listed in a text file and inventory the computer processor, memory, IP, and Hard drive space. The portion that inventorys the hard drive space was written by some else and the rest I got it from MS website along with other sites. This script will dump the info to a csv file which can then be imported into a database if you want. Being new to scripting I haven’t touched databases yet but see its importance. Again, not much commenting on the script but it works really well.
Continue reading ‘Inventory Hardware VBScript’
Published September 23rd, 2008
in Uncategorized.
I began scripting a couple of months ago and wrote this script to inventory the version of norton installed on client computers. In my enviroment I simply export the computer accounts to a text file and run this script. As I get better with vbscript I’ll be able to connect directly to AD. It could use some comments which I’ll add later. Hope this helps someone.
Continue reading ‘Norton Inventory VBScript’