简体   繁体   English

Powershell CM2012导入具有XML的应用程序

[英]Powershell CM2012 import Application with XML

I have created a powershell script to import applications to CM2012 based on input in a XML file example I found. 我创建了一个powershell脚本,根据我发现的XML文件示例中的输入将应用程序导入CM2012。 Does anybody know where I can an example of the XML import file that is complete with all settings/parameters? 有人知道在哪里可以找到所有设置/参数都完整的XML导入文件的示例吗?

The file looks like this: 该文件如下所示:

<Applications>
<Application>
<Name>Powershell Import</Name>
<Description>Import with Powershell</Description>
<Manufacturer> Johan Powershell</Manufacturer>
<SoftwareVersion>3</SoftwareVersion>
<AutoInstall>false</AutoInstall>
<DeploymentTypes>
<DeploymentType>
<MsiInstaller>true</MsiInstaller>
<InstallationFileLocation>\\test</InstallationFileLocation>
</DeploymentType>
<DeploymentType>
<ScriptInstaller>true</ScriptInstaller>
<DeploymentTypeName>Install Thinkiosk</DeploymentTypeName>
<InstallationProgram>msiexec /i \\corp\users\udc\a920268\Program\Quest_ActiveRolesManagementShellforActiveDirectoryx64_151.msi /qn</InstallationProgram>
<InstallationBehaviorType>InstallForSystem</InstallationBehaviorType>   <!-- InstallForSystem; InstallForUser; InstallForSystemIfResourceIsDeviceOtherwiseInstallForUser -->
<ContentLocation>\\test</ContentLocation>
<LogonRequirementType>WhereOrNotUserLoggedOn</LogonRequirementType>     <!-- OnlyWhenNoUserLoggedOn; OnlyWhenUserLoggedOn; WhereOrNotUserLoggedOn -->
</DeploymentType>
</DeploymentTypes>
</Application>
</Applications>

Say for example I want to change Language I have no idea what it should be named in the XML file or under which category? 例如,说我想更改语言,我不知道在XML文件中应将其命名为哪个类别?

I've just started playing around with SCCM2012 objects. 我刚刚开始玩SCCM2012对象。

Can't you check another application and see how the fields are named? 您不能检查其他应用程序并查看字段的命名方式吗?

In below example I've used the application with LocalizedDisplayName "Google Chrome" 在下面的示例中,我将应用程序与LocalizedDisplayName“ Google Chrome”一起使用

$DeploymentTypes = Get-CMDeploymentType -ApplicationName "Google Chrome"
$SDMPackageXML = $DeploymentTypes | Select SDMPackageXML -ExpandProperty SDMPackageXML

You can deserialize the xml to an object like this: 您可以将xml反序列化为这样的对象:

$DTInfo = [Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString($SDMPackageXML)

You can than drill down into "DeploymentTypes" 然后,您可以深入查看“ DeploymentTypes”

$DTInstances = $DTInfo.DeploymentTypes

And from there you can drill down into for instance "Installer" 从那里您可以深入到“安装程序”

$DTInstance = $DTInstances[0]
$DTInstaller = $DTInstance | Select Installer -ExpandProperty Installer

Hope this can help. 希望这会有所帮助。 Good luck with your script. 祝您脚本工作顺利。

Grts. ts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM