我有一个脚本,下载ps1文件在新机器启动运行。我不想安装任何PowerShell附加或扩展方法。我只想解锁文件并运行它们。有什么建议么?从'System.Net.WebClient.DownloadFile''解锁'ps1文件的快速和肮脏的方式
$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