þÿ#Requires -Version 2.0 #Jeffery Hicks #http://jdhitsolutions.com/blog # **************************************************************** # * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED * # * THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK. IF * # * YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, * # * DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING. * # **************************************************************** $profile | get-member -member noteproperty | foreach { $file=$profile.($_.name) if (test-path $file) { write-host "OK: $file" -foregroundcolor Green } else { write-host "Creating: $file" -foregroundcolor Red #split off the path and verify it exists. If not, #create it $parent=Split-Path($file) if (! (test-path $parent)) {mkdir $parent | out-Null} #Create the profile script $content="#Created {0} by {1}\{2} and left intentionally empty." -f (get-date),$env:userdomain,$env:username Set-Content -path $file -value $content -PassThru #insert your code here to digitally sign the script } } #end foreach