How our script works:
This is our sample ini
file:
The [Ini] version part.
The [Forbidden] part.
The [PACKAGE] part.
What do you need to use
this script?
# Edit this part to a share for central managment "\\share\folder\"
This is my own personal blog about Application Deployment, Packaging and Virtualization using ITMS(Altiris), Symantec Endpoint Virtualization(SWS/SWV), MSI, MSIX,APPX & APP-V. The opinions and solutions which I provide here are entirely my own ideas and does not reflect the opinion or view of my employer.
An even
better, faster and more modern method for setting company and location
variables is just using the registry. In my previous article about dynamic
scripting I was using environment variables, now I just use the registry.
A sample powershell script:
$PC_COMPANY =
(Get-ItemProperty
HKLM:\SOFTWARE\COMPANYVAR\PC_COMPANY).PC_COMPANY Write-Output
"Original registry key: $($PC_COMPANY)" #$PC_LOCATION =
(Get-ItemProperty
HKLM:\SOFTWARE\COMPANYVAR\PC_LOCATION).PC_LOCATION #Write-Output
"Original registry key: $($PC_LOCATION)" if ((Get-WmiObject Win32_OperatingSystem).name -notmatch "XP") { $programfiles = (Get-Content env:"ProgramFiles(x86)") } $Destination =
"$ProgramFiles\Elements\ElementsOutlook\ElementsOutlook\Config\" New-Item -ItemType Directory -Path $Destination if
($PC_COMPANY -eq "COMPANY1") {
Copy-Item -Path "ConfigFiles\ COMPANY1\*"
$Destination -Recurse -Force
} else {
if ($PC_COMPANY -eq
"COMPANY2") {
Copy-Item -Path "ConfigFiles\COMPANY2\*"
$Destination -Recurse -Force
} else {
if ($PC_COMPANY -eq "COMPANY3") {
Copy-Item -Path
"ConfigFiles\COMPANY3\*" $Destination -Recurse -Force
} else {
if ($PC_COMPANY -eq "COMPANY4") {
Copy-Item -Path "ConfigFiles\COMPANY4\*"
$Destination -Recurse -Force
} else {
if ($PC_COMPANY -eq
"COMPANY5") {
Copy-Item -Path "ConfigFiles\COMPANY5\*" $Destination -Recurse -Force
} else {
if
($PC_COMPANY -eq "COMPANY6") {
Copy-Item -Path "ConfigFiles\COMPANY6\*"
$Destination -Recurse -Force
} else {
Exit
}
}
}
}
} } |
<?xml version="1.0"
encoding="utf-8"?>
<!--
Update appv package manifest using the following
command line:
TweakAppv.exe /update "Your
Application.appv" /transformmanifest AppxManifest.xml
"DisableBrowserHelperObject.xsl"
-->
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:appx="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appv="http://schemas.microsoft.com/appv/2010/manifest"
xmlns:appv1.1="http://schemas.microsoft.com/appv/2013/manifest"
xmlns:appv1.2="http://schemas.microsoft.com/appv/2014/manifest">
<xsl:output method="xml"
version="1.0" omit-xml-declaration="no"
encoding="UTF-8" standalone="yes"
indent="yes"/>
<!-- Copy nodes that are not BrowserPlugin
-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates
select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Comment BrowserPlugin -->
<xsl:template
match="/appx:Package/appv:Extensions/*[local-name()='Extension' and
namespace-uri()='http://schemas.microsoft.com/appv/2013/manifest' and
@Category='AppV.BrowserPlugin' and
*[@Subcategory='BrowserHelperObject']]">
<xsl:text
disable-output-escaping="yes"> <!-- </xsl:text>
<xsl:copy>
<xsl:apply-templates
select="node()|@*"/>
</xsl:copy>
<xsl:text
disable-output-escaping="yes"> --> </xsl:text>
</xsl:template>
</xsl:transform>
|
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appx="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appv="http://schemas.microsoft.com/appv/2010/manifest"
xmlns:appv1.1="http://schemas.microsoft.com/appv/2013/manifest"
xmlns:appv1.2="http://schemas.microsoft.com/appv/2014/manifest"
version="1.0"
exclude-result-prefixes="appx">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template
match='/appx:Package/appv:Extensions/appv:Extension[@Category="AppV.Objects"]'
/>
<xsl:template
match="/appx:Package/appv:Extensions">
<xsl:copy>
<xsl:copy-of
select="@*|node()"/>
<appv:Extension
Category="AppV.Objects">
<appv:Objects>
<appv:NotIsolate>
<appv:Object
Name="*" />
</appv:NotIsolate>
</appv:Objects>
</appv:Extension>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
|
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appx="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appv="http://schemas.microsoft.com/appv/2010/manifest"
xmlns:appv1.1="http://schemas.microsoft.com/appv/2013/manifest"
xmlns:appv1.2="http://schemas.microsoft.com/appv/2014/manifest"
version="1.0"
exclude-result-prefixes="appx">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template
match='/appx:Package/appv:Extensions/appv:Extension[@Category="AppV.Objects"]'
/>
</xsl:stylesheet>
|
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appx="http://schemas.microsoft.com/appx/2010/manifest"
xmlns:appv="http://schemas.microsoft.com/appv/2010/manifest"
xmlns:appv1.1="http://schemas.microsoft.com/appv/2013/manifest"
xmlns:appv1.2="http://schemas.microsoft.com/appv/2014/manifest"
version="1.0"
exclude-result-prefixes="appx">
<xsl:param name="VFS"
select="true"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates
select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template
match="appx:Package/appx:Properties/appv1.2:FullVFSWriteMode">
<xsl:copy>
<xsl:value-of
select="$VFS"/>
</xsl:copy>
</xsl:template>
</xsl:transform>
|
;twc
;Appv:ComIsolated
6
;appv:SoftwareClients
7
;appv:Objects
8
Del-Nodes
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:COM"
Del-Nodes
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:SoftwareClients"
Del-Nodes
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:Objects"
;end
;Appv:COMOFF
6,23,24,25
New-Element
"AppxManifest.xml" -elementname "appv:ExtensionsConfiguration" -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration" -elementname
"appv:COM" -elementtext
" " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
Set-ElementAttribute "AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:COM" -AttributeName
"Mode" -AttributeValue "Off"
;end
;Appv:COMIntegrated
6,23,24,31,32,33-34,35-36
;New-Element
"AppxManifest.xml" -elementname "appv:ExtensionsConfiguration" -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
;New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration" -elementname
"appv:COM" -elementtext
" " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:COM"
-elementname "appv:IntegratedCOMAttributes"
-elementtext " " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
Set-ElementAttribute "AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:COM" -AttributeName
"Mode" -AttributeValue
"Integrated"
Set-ElementAttribute "AppxManifest.xml" -xpath
"appv:ExtensionsConfiguration/appv:COM/appv:IntegratedCOMAttributes"
-AttributeName "InProcessEnabled"
-AttributeValue "true"
Set-ElementAttribute "AppxManifest.xml" -xpath
"appv:ExtensionsConfiguration/appv:COM/appv:IntegratedCOMAttributes"
-AttributeName "InProcessEnabled"
-AttributeValue "false"
Set-ElementAttribute "AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:COM/appv:IntegratedCOMAttributes"
-AttributeName "OutOfProcessEnabled"
-AttributeValue "true"
Set-ElementAttribute "AppxManifest.xml" -xpath
"appv:ExtensionsConfiguration/appv:COM/appv:IntegratedCOMAttributes"
-AttributeName "OutOfProcessEnabled"
-AttributeValue "false"
;end
;appv:SoftwareClients
7,23,24,42,43,44-45
;New-Element
"AppxManifest.xml" -elementname "appv:ExtensionsConfiguration" -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
;New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration" -elementname
"appv:SoftwareClients" -elementtext " " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:SoftwareClients"
-elementname "appv:ClientConfiguration"
-elementtext " " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
Set-ElementAttribute "AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:SoftwareClients" -AttributeName
"Enabled" -AttributeValue
"false"
Set-ElementAttribute "AppxManifest.xml" -xpath
"appv:ExtensionsConfiguration/appv:SoftwareClients/appv:ClientConfiguration"
-AttributeName "EmailEnabled"
-AttributeValue "true"
Set-ElementAttribute "AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:SoftwareClients/appv:ClientConfiguration"
-AttributeName "EmailEnabled"
-AttributeValue "false"
;end
;appv:Objects
8,23,50,51,52
;New-Element
"AppxManifest.xml" -elementname "appv:ExtensionsConfiguration" -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration" -elementname
"appv:Objects" -elementtext
" " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
New-Element
"AppxManifest.xml" -xpath "appv:ExtensionsConfiguration" -elementname
"appv:ApplicationCapabilities" -elementtext " " -namespaceURI
"http://schemas.microsoft.com/appv/2010/manifest"
-createifnotexist
Set-ElementAttribute "AppxManifest.xml" -xpath "appv:ExtensionsConfiguration/appv:Objects" -AttributeName
"Enabled" -AttributeValue
"false"
;end
|