我想自动化为NAV和BC下载最新CU的过程。我编写了powershell脚本,但仍然需要部分如何从此页面(https://www.microsoft.com/en-us/download/details.aspx?id=58275)中下载zip文件
这是我到目前为止编写的代码:
$FeedUrl = "https://support.microsoft.com/app/content/api/content/feeds/sap/en-gb/dea12e4a-4dd3-35e1-2577-45df252a2b9c/atom"
$FeedFilePath = "C:\Test\Feed.xml"
$ArticlePath = "C:\Test\Article.html"
$DownloadPagePath = "C:\Test\Download.html"
Download_File -Url $FeedUrl -FileName $FeedFilePath
[xml]$Content = Get-Content $FeedFilePath
$Feed = $Content.feed
$SearchString = "Cumulative Update * for Microsoft Dynamics NAV 2018 *"
foreach($item in $Feed.entry){
if($item.title -like $SearchString){
Download_File -Url $item.link.href -FileName $ArticlePath
$Article = Get-Content $ArticlePath | Out-String
$endPos = 1
$startPos = $Article.IndexOf('http://www.microsoft.com/downloads/details.aspx?familyid=', $endPos)
$endPos = $Article.IndexOf('\"', $startPos)
$DownloadUrl = $Article.Substring($startPos, $endPos - $startPos)
break
}
}
Download_File -Url $DownloadUrl -FileName $DownloadPagePath
答案 0 :(得分:0)
您看到了吗?
http://www.waldo.be/2016/12/09/automate-downloads-of-cumulative-updates/
我也想知道为什么你需要这个? 我认为拉docker映像更容易。即使您不需要安装介质。