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
Post a Comment