Quick and Dirty way to 'Unblock' ps1 files from 'System.Net.WebClient.DownloadFile'


i have script downloads ps1 files run on new machine start up. don't want install powershell add in or extension methods. want unblock files , run them. suggestions?

$scriptsourcepath = "http://myurl/" $scripts = "sqlsetup-admin.ps1","sqlsetup-nonadmin.ps1","sqlconfigure.bat" $downloadpath = "d:\vncutil\" $clnt = new-object system.net.webclient   foreach($script in $scripts){  $url = $scriptsourcepath + $script  $file = join-path $downloadpath $script  $clnt.downloadfile($url, $file) } $batfile = join-path $downloadpath "sqlconfigure.bat" $execstr = '$batfile >>d:\vncutil\sqlconfigure.log' & $execstr

c s

you use get-content read content , pipe new file...

get-content blockedfile.ps1| add-content unblockedfile.ps1



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607