I have a script that downloads ps1 files to run on new machine start up. I don’t want to install any powershell add in or extension methods. I just want to unblock the files and run them. Any 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
Got the answer on another forum: Not that @driis wasn’t on target but this is more powershelly
http://social.technet.microsoft.com/Forums/en/winserverpowershell/thread/0b5f1fa6-981e-4696-84bc-b8046564ec8b