<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[gOxiA=苏繁=SuFan Blog]]></title> 
<link>https://goxia.maytide.net/index.php</link> 
<description><![CDATA[gOxiA,苏繁,sufan,Microsoft MVP]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[gOxiA=苏繁=SuFan Blog]]></copyright>
<item>
<link>https://goxia.maytide.net/read.php/2185.htm</link>
<title><![CDATA[适用于 Win32 应用的 PowerShell 脚本安装程序]]></title> 
<author>gOxiA &lt;sufan_cn@msn.com&gt;</author>
<category><![CDATA[Microsoft Cloud]]></category>
<pubDate>Tue, 24 Feb 2026 08:15:59 +0000</pubDate> 
<guid>https://goxia.maytide.net/read.php/2185.htm</guid> 
<description>
<![CDATA[ 
	<p><img alt="Intune-logo-wide" src="https://goxia.maytide.net/ftpup/2018/HOWTO--Windows-Backup_971C/Intune-logo-wide_thumb.png"></p><p><font color="#fd3f0d" size="4"><strong>适用于 Win32 应用的 PowerShell 脚本安装程序</strong></font></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2026年新年伊始，Intune 公布了最新的功能 - 允许在添加 Win32 应用时上传 PowerShell 脚本作为安装程序，而不再只是指定命令行。在过去我们基本的流程是测试验证应用程序安装包的静默参数，然后根据需要准备安装脚本，并使用“<a href="https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool.git" target="_blank">Microsoft Win32 Content Prep Tool</a>”对应用程序安装包进行 .intunewin 打包，然后在 Intune 中上传该文件包（.intunewin），提供相关的信息和安装命令行进行发布。</p><p><a href="https://goxia.maytide.net/ftpup/2026/e3c54211d9b3_D461/intune-win32app-add.png"><img width="630" height="624" title="intune-win32app-add" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="intune-win32app-add" src="https://goxia.maytide.net/ftpup/2026/e3c54211d9b3_D461/intune-win32app-add_thumb.png" border="0"></a></p><p><a href="https://goxia.maytide.net/ftpup/2026/e3c54211d9b3_D461/intune-win32app-add-1.png"><img width="630" height="624" title="intune-win32app-add-1" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="intune-win32app-add-1" src="https://goxia.maytide.net/ftpup/2026/e3c54211d9b3_D461/intune-win32app-add-1_thumb.png" border="0"></a></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这种方法的繁琐程度也是显而易见，一旦需要修改安装脚本就需要重新打包上传安装包，即使是使用默认的命令行也需要维护这些安装包的安装信息。现在，Intune 允许在发布 Win32 应用时额外上传用于安装的 PowerShell 脚本，这一举措将极大提升 IT 的效率，简化发布流程。</p><p><a href="https://goxia.maytide.net/ftpup/2026/e3c54211d9b3_D461/intune-win32app-add-2.png"><img width="630" height="383" title="intune-win32app-add-2" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="intune-win32app-add-2" src="https://goxia.maytide.net/ftpup/2026/e3c54211d9b3_D461/intune-win32app-add-2_thumb.png" border="0"></a></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 如上图所示，我们可以将“安装程序类型”指定为“PowerShell 脚本”，然后单独上传用于安装的 ps1 文件即可，Intune 会自行将脚本与应用内容一起打包，并在与应用安装程序相同的上下文中运行该脚本。这对于要部署安装复杂应用的场景非常重要，我们可以在 ps1 中做正式安装前的检查工作，对安装过程中的配置更改，在安装后进行实例的验证，当然如果要基于设备状态和运行环境执行复杂条件逻辑，那基于此方式的安装都会非常便利，且不用再将 ps1 脚本与应用安装包一同打包 .intunewin 文件，也减少了维护的复杂度。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对于此 PowerShell 安装脚本的支持需要注意以下几点：</p><ul><li>脚本的大小限制为 50KB</li><li>脚本与应用安装程序一致的上下文中运行</li><li>脚本中的返回代码会确定安装成功或失败状态</li><li>脚本应以无提示方式运行，无需用户交互</li></ul><p><br/></p><p>推荐官方参考：</p><p><a href="https://learn.microsoft.com/en-us/intune/intune-service/fundamentals/whats-new#week-of-january-12-2026/?WT.mc_id=WDIT-MVP-4000544" target="_blank">What's new in Microsoft Intune - Week of January 12, 2026 &#124; Microsoft Learn</a></p><p><a href="https://learn.microsoft.com/en-us/intune/intune-service/apps/apps-win32-app-management#powershell-script-installer/?WT.mc_id=WDIT-MVP-4000544" target="_blank">Win32 app management in Microsoft Intune &#124; Microsoft Learn</a></p>
]]>
</description>
</item>
</channel>
</rss>