Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell CM2012使用XML导入应用程序_Xml_Powershell_Sccm - Fatal编程技术网

Powershell CM2012使用XML导入应用程序

Powershell CM2012使用XML导入应用程序,xml,powershell,sccm,Xml,Powershell,Sccm,我已经创建了一个powershell脚本,根据我找到的XML文件示例中的输入将应用程序导入CM2012。 有人知道我可以在哪里找到一个包含所有设置/参数的XML导入文件的示例吗 该文件如下所示: <Applications> <Application> <Name>Powershell Import</Name> <Description>Import with Powershell</Description> <Ma

我已经创建了一个powershell脚本,根据我找到的XML文件示例中的输入将应用程序导入CM2012。 有人知道我可以在哪里找到一个包含所有设置/参数的XML导入文件的示例吗

该文件如下所示:

<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>
$DTInfo = [Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString($SDMPackageXML)

Powershell导入
使用Powershell导入
约翰·鲍瑟尔
3.
假的
真的
\\试验
真的
安装Thinkiosk
msiexec/i\\corp\users\udc\a920268\Program\Quest\u ActiveRolesManagementShellforActiveDirectoryx64\u 151.msi/qn
InstallForSystem
\\试验
WhereOrNotUserLoggedOn

例如,假设我想更改语言,我不知道它应该在XML文件中命名,或者在哪个类别下命名?

我刚刚开始使用SCCM2012对象

您不能检查另一个应用程序并查看字段的名称吗

在下面的示例中,我使用了本地化显示名为“Google Chrome”的应用程序

可以将xml反序列化为如下对象:

<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>
$DTInfo = [Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString($SDMPackageXML)
您可以深入了解“DeploymentTypes”

从那里你可以深入到例如“安装程序”

希望这能有所帮助。祝你的剧本好运


Grts.

Ahhh这是我的一天,但我还有一个关于Add CMDeployment cmdlet的问题,我如何添加卸载命令?cmdlet会自动为我生成此内容,我不希望这样,因为我需要进行日志记录才能卸载。以及如何使用新的CMApplication或set CMApplication设置默认语言??
$DTInstance = $DTInstances[0]
$DTInstaller = $DTInstance | Select Installer -ExpandProperty Installer