10 cool things to do in Powershell

 

http://blogs.techrepublic.com.com/10things/?p=302

 

As a little “bonus” to this post here is a simple copy from / to directory script for your enjoyment.

 

# Simple copy script
# (c) Nathan Bunting
# Don't forget to change the destination & source.
$source="C:\Users\mysteryn11\AppData\Local\Temp"; $destination="c:\destination"
# If you want to create a log change the logpath to where you want it to go.
$logpath="%temp%\copy_script_log.txt"
#
# Here I create the "easyview" function so that the output doesn't scroll too quickly:
function EasyView { process { $_; Start-Sleep -seconds 1}}
#
# Enter the filetypes you want to exclude in the following array:
$excludes="*.thumbs","*.temp"
Write-Host "Source=" $source -foreground "green"; Write-Host "Destination=" $destination -foreground "red" | EasyView
Write-Host "Following filetypes are excluded..." $excludes | EasyView
Write-Host "Synchronising directories. Please wait..." | EasyView
copy-item -path $source -destination $destination -exclude $excludes -force -recurse
get-childitem $destination\temp | out-file -filepath $logpath -force -append
Write-Host "Complete."

Posted on 9:49 AM by Nathan aka Mysteryn11 and filed under | 0 Comments »

0 comments: