Archive

Posts Tagged ‘Scripting’

PowerShell script to list any desired file type(s)

September 1st, 2009 1 comment

Here’s a PowerShell script that produces the list of desired file types (jpg, bmp, exe, dll, etc.)

Change $path=”C:\” to desired directory.

Change ‘.bmp’ to desired file extension.

If you need to find more that one file type, then add “-or ($file.Extension -eq ‘.some_extension’)” in the if statement, e.g.:

if (($file.Extension -eq ‘.bmp’) -or ($file.Extension -eq ‘.jpg’))

if (($file.Extension -eq ‘.bmp’)-or ($file.Extension -eq ‘.jpg’) -or ($file.Extension -eq ‘.gif’))

$path="c:\"
function showdir {
param (
$path
)
$files=Get-ChildItem $path
foreach ($file in $files) {
if ($file.PSIsContainer) {
showdir -path $file.FullName
}
else {
if (($file.Extension -eq '.bmp')) {
$f=gwmi -Class CIM_DataFile -Filter "Name='$(add_slhs($file.FullName))'"
Write-Host $file.FullName,$f.Version
}
}
}
}
function add_slhs($src) {
$dst=""
for ($i=0;$i -lt $src.length;$i++) {
if ($src[$i] -ne "\") {
$dst=$dst+$src[$i]
}
else {
$dst=$dst+$src[$i]+"\"
}
}
return $dst
} 

showdir -path $path

Enjoy!

Script to fix error with start up of AU and BITS (EventID 7023 and 7024)

June 30th, 2009 No comments

This script detects and tries to fix the error related to start up of Automatic Updates and BITS services on network computers. Such error is related to security identifier (EventID 7023 and EventID 7024).  This problem is usually observed on network computers after applying changes to group policies. In such cases the script will reset a security identifier as per Microsoft KB 555336 (http://support.microsoft.com/kb/555336) and start Automatic Updates and BITS. Can be usefull for networks where Windows Server Update Services 3.0 (WSUS) is used.

Script is taken from: http://forum.vingrad.ru/forum/topic-154708/view-all.html

Read more…

Script for remote reboot/shutdown, power off and more.

June 30th, 2009 No comments

Script for remote reboot/shutdown, power off, etc. You must have proper rights on a remote computer  for this script to work.

Read more…

VB Script to query domain computers for currently logged in users

June 30th, 2009 No comments
The script will query domain computers for logged on users on each computer

Some links for Windows scripting… (Microsoft)

March 20th, 2009 No comments