Advertise with Googlier.comdanard.net - PowerShell
http://danard.net/tags/powershell
frSystray Info: information sur votre ordinateur
http://danard.net/content/systray-info-information-sur-votre-ordinateur
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Ce script PowerShell lance une petite application en zone de notification qui affiche les principales informations de la machine dans une fenêtre WPF/XAML, à la façon de BGInfo, avec gestion d’instance unique et mise à jour dynamique de certaines données.</p>
<p>Les données affichées proviennent de diverses sources accessibles en PowerShell, que ce soit par fonctions intégrées, requête WMI ou lecture du registre.</p>
<p>Tout le contenu affiché est défini par section, comportant un label, les données à afficher, et la fonction à appeler pour récupérer ces données.</p>
<p>Il inclut aussi une fonction de copie des données (plus facilement utilisable qu'une copie-écran).</p>
<p> </p>
<p>Mise à jour 2026-03-22:</p>
<p>La fonction déterminant la version de Windows a été corrigée, elle se basait sur la mauvaise entrée de registre.</p>
<p>Un script a été ajouté, permettant de gérer l'affichage des icônes dans la zone de notifications, dans le contexte d'un utilisateur.</p>
<p>Ce script lit les informations stockées dans "HKCU:\Control Panel\NotifyIconSettings", entrée de registre qui contient une liste d'exécutables pouvant afficher des notifications.</p>
<p>Chaque entrée dispose d'une valeur "IsPromoted" qui permet de définir l'état d'affichage: 1 = constamment visible, 0 = masqué.</p>
<p>Dans le cas de scripts PowerShell, le script se base sur le tooltip pour faire la sélection.</p>
</div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">01/03/2026 - 20:17</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">22/03/2026 - 11:34</div></div></section><div class="field field-name-field-file field-type-file field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even"><span class="file"><img class="file-icon" alt="Icône paquet" title="application/zip" src="/modules/file/icons/package-x-generic.png" /> <a href="http://danard.net/sites/default/files/download/SysTrayInfo_v2.zip" type="application/zip; length=70636">SysTrayInfo_v2.zip</a></span></div></div></div><div class="field field-name-field-image field-type-image field-label-hidden view-mode-rss"><div class="field-items"><figure class="clearfix field-item even" rel="og:image rdfs:seeAlso" resource="http://danard.net/sites/default/files/styles/medium/public/field/image/Example.png?itok=wJ6PBDqP"><a href="http://danard.net/sites/default/files/field/image/Example.png"><img typeof="foaf:Image" class="image-style-medium" src="http://danard.net/sites/default/files/styles/medium/public/field/image/Example.png?itok=wJ6PBDqP" width="189" height="220" alt="" /></a></figure></div></div><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/8" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Windows</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item even" rel="dc:subject"><a href="/tags/xaml" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">XAML</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/15" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Poste de travail</a></li></ul></section>Sun, 01 Mar 2026 19:17:16 +0000webmaistre35 at http://danard.nethttp://danard.net/content/systray-info-information-sur-votre-ordinateur#commentsInterface d'administration
http://danard.net/content/interface-dadministration
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Trop souvent j'ai eu besoin de travailler sur la même machine en utilisant plusieurs comptes afin d'effectuer des tâches d'administration IT.</p>
<p>S'il est toujours possible de lancer des programmes "en tant que...", cela est vite lassant.</p>
<p>J'ai donc cherché à mettre au point un outil que je pouvais lancer une fois pour y revenir à chaque fois qu'il me fallait exécuter une tâche avec des privilèges différents de ceux possédés par mon compte "bureautique".</p>
<p>La version proposée ici répond pour l'instant à mes besoins.</p>
<p>Elle s'adapte aux outils présents sur le poste de travail standard ou à une machine d'administration, et peut être facilement étendue pour ajouter d'autres éléments, même si par choix pratique leur liste est intégrée dans le code plutôt que de figurer dans un fichier externe.</p>
<p><strong><em>2023-02-19: Nouvelle version</em></strong></p>
<p>La nouvelle version permet maintenant de diviser la liste d'outils en plusieurs volets, afin de regrouper les outils suivants les domaines d'utilisation.</p>
<p>Les divers onglets sont définis comme suit:</p>
<pre>
$tabsList = @(
[PSCustomObject]@{
Name = "ADInfra"
Label = "Active Directory & Infra"
Background = "Aqua"
}
[PSCustomObject]@{
Name = "ComputerMgmt"
Label = "Computer Mgmt Tools"
Background = "Aquamarine"
}
[PSCustomObject]@{
Name = "Other"
Label = "Other Tools"
Background = "LightGreen"
}
)
</pre><p>Les outils sont eux définis comme suit:</p>
<pre>
$toolsList = @(
[PSCustomObject]@{
Name = "DSAC_EXE"
Label = "Active Directory Administration Center"
FilePath = $env:SystemRoot + "\System32\dsac.exe"
Parameters = ""
TabName = "ADInfra"
}
[PSCustomObject]@{
Name = "REGEDIT_EXE"
Label = "Registry Editor"
FilePath = $env:SystemRoot + "\regedit.exe"
Parameters = "/s"
TabName = "ComputerMgmt"
}
[PSCustomObject]@{
Name = "CHROME_EXE"
Label = "Google Chrome"
FilePath = $env:ProgramFiles + "\Google\Chrome\Application\Chrome.exe"
Parameters = "https://danard.net"
TabName = "Other"
}
}
</pre><p>Pour améliorer l'aspect visuel, la barre de statut utilise la même couleur de fond que la fenêtre principale, et est placée en bas de fenêtre.</p>
<p>Note: contrairement à MS Edge, Google Chrome peut être lancé dans un contexte utilisateur alternatif à celui utilisé pour la session ouverte.</p>
</div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">23/11/2021 - 20:43</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">19/02/2023 - 21:15</div></div></section><div class="field field-name-field-file field-type-file field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even"><span class="file"><img class="file-icon" alt="Icône paquet" title="application/zip" src="/modules/file/icons/package-x-generic.png" /> <a href="http://danard.net/sites/default/files/download/AdminUI_0.zip" type="application/zip; length=52784">AdminUI.zip</a></span></div></div></div><div class="field field-name-field-image field-type-image field-label-hidden view-mode-rss"><div class="field-items"><figure class="clearfix field-item even" rel="og:image rdfs:seeAlso" resource="http://danard.net/sites/default/files/styles/medium/public/field/image/AdminUI_1.png?itok=EuTJt9GD"><a href="http://danard.net/sites/default/files/field/image/AdminUI_1.png"><img typeof="foaf:Image" class="image-style-medium" src="http://danard.net/sites/default/files/styles/medium/public/field/image/AdminUI_1.png?itok=EuTJt9GD" width="220" height="188" alt="" /></a></figure></div></div><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/8" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Windows</a></li><li class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/15" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Poste de travail</a></li><li class="field-item even" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/2" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Outils</a></li></ul></section>Tue, 23 Nov 2021 19:43:53 +0000Roland Danard34 at http://danard.nethttp://danard.net/content/interface-dadministration#commentsListe de mise à jour installées
http://danard.net/content/liste-de-mise-%C3%A0-jour-install%C3%A9es
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Une commande rapide pour afficher la liste des mises à jours installées, classée par date :</p>
<pre>
Get-Package -ProviderName msu | ForEach-Object { [<strong>PSCustomObject</strong>]@{
Date = [<strong>datetime</strong>]::ParseExact(($_.Metadata['Date'])[0], (Get-Culture).DateTimeFormat.ShortDatePattern + " " + (Get-Culture).DateTimeFormat.LongTimePattern, $null)
Name = $_.Name
Status = $_.Status
Result = $_.Metadata['ResultCode'][0]
} } | Sort-Object -Property Date</pre></div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">10/06/2020 - 07:45</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">10/06/2020 - 07:47</div></div></section><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/8" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Windows</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item even" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li></ul></section>Wed, 10 Jun 2020 05:45:38 +0000Roland Danard33 at http://danard.nethttp://danard.net/content/liste-de-mise-%C3%A0-jour-install%C3%A9es#commentsOffice 365 ProPlus - Gestion automatique des sources
http://danard.net/content/office-365-proplus-gestion-automatique-des-sources
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><h2><strong>Présentation</strong></h2>
<p>L’installation d’Office 365 sur un poste, ou sa reconfiguration (telle que décrite ici), suppose la présence des sources d’installation sur le poste lui-même ou sur un partage réseau, dans le cas où il n’est pas souhaité ou souhaitable que le poste de travail télécharge lui-même les sources depuis le Content Delivery Network de Microsoft.</p>
<p>Afin d’éviter d’installer une version ancienne qui devrait immédiatement être mise à jour (ce qui est susceptible de se produire en particulier lors d’une reconfiguration), il importe que ces fichiers sources soient mis à jour régulièrement, au rythme des mises à jour fournies par l’éditeur.</p>
<p>C’est donc une tâche qu’il convient d’automatiser au maximum.</p>
<p>La <a href="http://tech.danard.net/content/office-365-proplus-g%C3%A9n%C3%A9ration-automatique-de-package">version précédente</a> dédiée à l’automatisation était centrée sur la réalisation d’un package MSI de déploiement des sources ; l’utilisation d’un script de commande impliquait certaines limitations, levées dans cette nouvelle version par le passage à PowerShell.</p>
<p>Le nouvel outil permet d'une part de télécharger les sources, pour mise à jour d'un point central utilisé pour l'installation ultérieure, et toujours de réaliser un package MSI destiné principalement à la mise à disposition des sources par un outil de déploiement (SCCM par exemple).</p>
<h2><strong>Principes</strong></h2>
<p>Le principe de fonctionnement est le suivant :</p>
<ul>
<li>Choix des paramètres correspondant à la version d’Office 365 ciblée (canal de mise à jour, version, plateforme, langues)</li>
<li>Téléchargement des sources correspondant aux paramètres indiqués, si demandé</li>
<li>Vérification des caractéristiques des sources disponibles</li>
<li>Génération d’un fichier MSI pour le déploiement des sources, si demandé</li>
</ul>
<p>Les informations générales sur les versions disponibles suivantes sont récupérées directement sur le site de <a href="https://docs.microsoft.com/en-us/officeupdates/update-history-office365-proplus-by-date">Microsoft</a>, pour chaque canal de mise à jour :</p>
<ul>
<li>N° de version (format YYMM, exemple : 1808)</li>
<li>N° de build correspondant à la dernière version disponible (format A.B, exemple : 10730.20348)</li>
</ul>
<p>Les paramètres choisis permettent de composer un fichier de configuration XML dédié au téléchargement des sources.</p>
<p>Une fonction dédiée permet de récupérer à partir des éléments présents dans un dossier de sources les informations relatives à la plateforme, la version et le n° de build, ce dernier n’étant pas forcément connu avant le téléchargement (si la version n’est pas spécifiée) et servant ensuite pour la génération du MSI.</p>
<h2><strong>Paramètres</strong></h2>
<p>Au niveau des paramètres, si le n° de version est omis, la version téléchargée est la plus récente disponible pour le canal de mise à jour considéré.</p>
<p>En pratique, le n° de version ne devrait être spécifié que dans le cas du canal de mise à jour semi-annuel, pour lequel 2 versions peuvent être disponibles en simultané.</p>
<p>Les paramètres linguistiques permettent de spécifier séparément les langues téléchargées en tant que packs complets (comprenant l’interface) et les outils de vérification linguistiques (grammaire et correction orthographique).</p>
<p>Les paramètres par défaut sont :</p>
<ul>
<li>Canal semi-annuel</li>
<li>Dernière version disponible</li>
<li>Plateforme 64 bits</li>
<li>Pack linguistique en-US</li>
<li>Pas d’outils de correction supplémentaires</li>
</ul>
<p>Pour le téléchargement des sources, il s’opère soit dans le dossier d’exécution du script, soit dans un dossier spécifié en paramètre.</p>
<p>De même pour la génération du fichier MSI, le dossier dans lequel le fichier doit être placé est paramétrable.</p>
<h2><strong>Génération du MSI</strong></h2>
<p>La génération du fichier MSI se fait par l’intermédiaire de WiX (Windows Installer XML) ; les diverses options concernant le fichier MSI sont spécifiées dans le fichier O365_Sources.wxs et sont :</p>
<ul>
<li>Génération de fichiers .CAB multiples (pour éviter à l’installation un blocage par certains antivirus quand la taille des sources dépasse les quelques giga octets)</li>
<li>Dossier de destination : C:\ProgramData\Office365SRC\<nom de dossier><br />
le nom de dossier final est calculé suivant le canal de mise à jour, faisant apparaître dans le cas du canal SA le n° de version</li>
<li>Version du MSI : correspond au numéro de build complet des sources d’Office 365, sous la forme 16.0.<n° build au format A.B></li>
</ul>
<p>Le nom du fichier MSI fait apparaître la version, le canal de mise à jour et le numéro de version du MSI.</p>
<p>A noter que dans le cas de la version 64 bits d'Office, les fichiers téléchargés peuvent être de taille supérieure à 2 gigaoctets, ce qui interdit dans ce cas leur incorporation dans un installeur au format MSI.</p>
</div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">20/06/2019 - 13:37</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">28/01/2020 - 13:17</div></div></section><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/tags/office-365" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Office 365</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/2" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Outils</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/wix" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">WiX</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/8" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Windows</a></li></ul></section>Thu, 20 Jun 2019 11:37:45 +0000Roland Danard31 at http://danard.nethttp://danard.net/content/office-365-proplus-gestion-automatique-des-sources#commentsRéseau - Détection du type de connexion
http://danard.net/content/r%C3%A9seau-d%C3%A9tection-du-type-de-connexion
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Il est souvent utile de connaître le type de connexion utilisée lors de l’exécution de certaines opérations sur un poste de travail, afin de réaliser ou non certaines opérations.</p>
<p>Par exemple, lors d’une mise à jour d’une version de Windows, il peut être souhaitable de bloquer la mise à jour si elle n’est pas exécutée sur le réseau interne de l’entreprise, ou au minimum d’avertir l’utilisateur des risques de l’opération.</p>
<p>Ou encore, si l’ordinateur est connecté en VPN, la mise à jour du client VPN demandera que la nouvelle version de la solution VPN soit téléchargée dans son intégralité avant que l’installation n’ait lieu…</p>
<p>Le script fourni ici commence par déterminer quelle est l’interface réseau utilisée pour la connexion au domaine, puis vérifie quel est son type, d’après les informations relatives au medium physique : 802.3, 802.11, Bluetooth, …</p>
<p>Les types ne correspondant pas à une connexion filaire ou sans fil sont considérés comme relevant du VPN.</p>
<hr />
<pre><span style="color:#008000;"><#</span>
.SYNOPSIS
<span style="color:#008000;">Get the type of network connection</span>
.DESCRIPTION
<span style="color:#008000;">Retrieve the network connection type when a computer is connected to a domain:
- LAN
- Wireless
- VPN</span>
.EXAMPLE
<span style="color:#008000;">Get-NetworkConnectionType</span>
.INPUTS
<span style="color:#008000;">none</span>
.OUTPUTS
<span style="color:#008000;">One of these string values:
- LAN
- Wireless
- VPN</span>
.NOTES
<span style="color:#008000;">version 1.0: initial version</span>
<span style="color:#008000;">#></span>
<span style="color:#0000FF;">function </span><span style="color:#808080;">Get-NetworkConnectionType</span> {
[<span style="color:#808080;">CmdletBinding</span>()]
[<span style="color:#808080;">OutputType</span>([<span style="color:#0000FF;">String</span>])]
<span style="color:#800080;">Param </span>()
<span style="color:#800080;">begin </span>{
$connectionType = <span style="color:#B22222;">"n/a"</span>
}
<span style="color:#800080;">process </span>{
<span style="color:#008000;"># get the connection which is used for domain access</span>
$connectionProfile = <span style="color:#808080;">Get-NetConnectionProfile</span> |<span style="color:#808080;"> Where-Object</span> { $_.NetworkCategory -eq <span style="color:#B22222;">"DomainAuthenticated"</span> }
<span style="color:#008000;"># if a connection exists, check the adapter in use</span>
<span style="color:#800080;">if </span>(<span style="color:#0000FF;">$null</span> -ne $connectionProfile) {
<span style="color:#008000;"># get the adapter</span>
$connectionAdapter = <span style="color:#808080;">Get-NetAdapter</span> -Name $connectionProfile.InterfaceAlias
<span style="color:#800080;">switch </span>($connectionAdapter.PhysicalMediaType ) {
<span style="color:#B22222;">"802.3"</span> {
$connectionType = <span style="color:#B22222;">"LAN"</span>
<span style="color:#800080;">break</span>;
}
<span style="color:#B22222;">"Native 802.11"</span> {
$connectionType = <span style="color:#B22222;">"Wireless"</span>
<span style="color:#800080;">break</span>;
}
<span style="color:#B22222;">"Bluetooth"</span> {
$connectionType = <span style="color:#B22222;">"Wireless"</span>
<span style="color:#800080;">break</span>;
}
<span style="color:#800080;">default </span>{
$connectionType = <span style="color:#B22222;">"VPN"</span>
}
}
}
}
<span style="color:#800080;">end </span>{
<span style="color:#808080;">Write-Output</span> $connectionType
}
}
</pre></div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">17/03/2019 - 18:17</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">17/03/2019 - 18:42</div></div></section><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/2" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Outils</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li><li class="field-item even" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/15" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Poste de travail</a></li></ul></section>Sun, 17 Mar 2019 17:17:41 +0000Roland Danard30 at http://danard.nethttp://danard.net/content/r%C3%A9seau-d%C3%A9tection-du-type-de-connexion#commentsOffice 365 - Reconfiguration après installation initiale
http://danard.net/content/office-365-reconfiguration-apr%C3%A8s-installation-initiale
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><h2>Principe</h2>
<p>La reconfiguration d'une installation d'Office 365 pour ajouter ou supprimer un composant (Access, Publisher, ...) un produit annexe (Visio, Project, ...), voire une langue d'interface, suppose une réinstallation de la suite, en prenant compte d'une part les ajouts/suppressions demandés, et d'autre part les éléments déjà installés.</p>
<p>Les sources d'Office 365 incluent déjà tous ces éléménts, indépendamment de ce qui a été demandé lors du téléchargement (le paramétrage effectué pour cette opération vise essentiellement à télécharger les composants linguistiques souhaités).</p>
<p>L'approche usuelle est de préparer pour chaque élément à ajouter/supprimer un fichier de configuration, précisant les opérations à effectuer comme lors d'une installation initiale, qui peut alors être appliqué sur le poste de travail.</p>
<p>Le défaut est qu'il est difficile de gérer la multiplicité des cas possibles, en particulier pour les composants d'Office ProPlus : il faut prévoir une configuration pour ajouter Access, une autre pour ajouter Publisher, une autre pour ajouter Publisher mais enlever Access, ...</p>
<p>Cela devient rapidement ingérable, surtout si on y ajoute la gestion des langues !</p>
<p>Et pour ajouter un peu de complexité, plusieurs versions d’Office 365 cohabitent, suivant les canaux de mise à jour choisis, avec parfois plusieurs versions différentes sur un même canal…</p>
<h2>Script de reconfiguration</h2>
<p>Le script de reconfiguration est là pour simplifier les opérations.</p>
<p>A partir des informations présentes sur la machine (voir l'article consacré à la description des entrées de registre liées à l'installation d'Office <a href="https://tech.danard.net/content/office-365-détermination-de-la-configuration-installée">ici</a>), un fichier de configuration au format XML est regénéré, correspondant au plus proche à ce qui a été exécuté pour l'installation.</p>
<p>Exemple :</p>
<table border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<div style="color: #000000;background-color: #ffffff;font-family: 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
<pre>
<span style="color:#800000"><Configuration></span>
<span style="color:#800000"> <Add</span><span style="color:#000000"> </span><span style="color:#ff0000">OfficeClientEdition</span><span style="color:#000000">=</span><span style="color:#0000ff">"32"</span><span style="color:#000000"> </span><span style="color:#ff0000">Channel</span><span style="color:#000000">=</span><span style="color:#0000ff">"Broad"</span><span style="color:#000000"> </span><span style="color:#ff0000">Version</span><span style="color:#000000">=</span><span style="color:#0000ff">"16.0.10730.20264"</span><span style="color:#000000"> </span><span style="color:#800000">></span>
<span style="color:#800000"> <Product</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"VisioStdXVolume"</span><span style="color:#800000">></span>
<span style="color:#800000"> <Language</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"fr-fr"</span><span style="color:#000000"> </span><span style="color:#ff0000">FallBack</span><span style="color:#000000">=</span><span style="color:#0000ff">"en-US"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> </Product></span>
<span style="color:#800000"> <Product</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"O365ProPlusRetail"</span><span style="color:#800000">></span>
<span style="color:#800000"> <ExcludeApp</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"onedrive"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> <ExcludeApp</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"access"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> <Language</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"fr-fr"</span><span style="color:#000000"> </span><span style="color:#ff0000">FallBack</span><span style="color:#000000">=</span><span style="color:#0000ff">"en-US"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> </Product></span>
<span style="color:#800000"> </Add></span>
<span style="color:#800000"> <Logging</span><span style="color:#000000"> </span><span style="color:#ff0000">Level</span><span style="color:#000000">=</span><span style="color:#0000ff">"Standard"</span><span style="color:#000000"> </span><span style="color:#ff0000">Path</span><span style="color:#000000">=</span><span style="color:#0000ff">"C:\InstallationLogs\Office365"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"></Configuration></span></pre></div>
</td>
</tr>
</tbody>
</table>
<p>Cette configuration est alors mise à jour pour tenir compte des ajouts ou suppressions demandés.</p>
<p>Par exemple, pour ajouter Access :</p>
<table border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<div style="color: #000000;background-color: #ffffff;font-family: 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
<pre>
<span style="color:#800000"><Configuration></span>
<span style="color:#800000"> <Add</span><span style="color:#000000"> </span><span style="color:#ff0000">OfficeClientEdition</span><span style="color:#000000">=</span><span style="color:#0000ff">"32"</span><span style="color:#000000"> </span><span style="color:#ff0000">Channel</span><span style="color:#000000">=</span><span style="color:#0000ff">"Broad"</span><span style="color:#000000"> </span><span style="color:#ff0000">Version</span><span style="color:#000000">=</span><span style="color:#0000ff">"16.0.10730.20264"</span><span style="color:#000000"> </span><span style="color:#800000">></span>
<span style="color:#800000"> <Product</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"VisioStdXVolume"</span><span style="color:#800000">></span>
<span style="color:#800000"> <Language</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"fr-fr"</span><span style="color:#000000"> </span><span style="color:#ff0000">FallBack</span><span style="color:#000000">=</span><span style="color:#0000ff">"en-US"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> </Product></span>
<span style="color:#800000"> <Product</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"O365ProPlusRetail"</span><span style="color:#800000">></span>
<span style="color:#800000"> <ExcludeApp</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"onedrive"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> <Language</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"fr-fr"</span><span style="color:#000000"> </span><span style="color:#ff0000">FallBack</span><span style="color:#000000">=</span><span style="color:#0000ff">"en-US"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> </Product></span>
<span style="color:#800000"> </Add></span>
<span style="color:#800000"> <Logging</span><span style="color:#000000"> </span><span style="color:#ff0000">Level</span><span style="color:#000000">=</span><span style="color:#0000ff">"Standard"</span><span style="color:#000000"> </span><span style="color:#ff0000">Path</span><span style="color:#000000">=</span><span style="color:#0000ff">"C:\InstallationLogs\Office365"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"></Configuration></span></pre></div>
</td>
</tr>
</tbody>
</table>
<p>Enfin, comme il s'agit au final de procéder à une réinstallation, la localisation des fichiers est ajoutée.</p>
<p>Par exemple, avec des sources disponibles sur un partage réseau :</p>
<table border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<div style="color: #000000;background-color: #ffffff;font-family: 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
<pre>
<span style="color:#800000"><Configuration></span>
<span style="color:#800000"> <Add</span><span style="color:#000000"> </span><span style="color:#ff0000">OfficeClientEdition</span><span style="color:#000000">=</span><span style="color:#0000ff">"32"</span><span style="color:#000000"> </span><span style="color:#ff0000">Channel</span><span style="color:#000000">=</span><span style="color:#0000ff">"Broad"</span><span style="color:#000000"> </span><span style="color:#ff0000">Version</span><span style="color:#000000">=</span><span style="color:#0000ff">"16.0.10730.20264"</span><span style="color:#000000"> </span><span style="color:#ff0000">SourcePath</span><span style="color:#000000">=</span><span style="color:#0000ff">"\\FileServer\Sources\Office365\1808-SA"</span><span style="color:#000000"> </span><span style="color:#800000">></span>
<span style="color:#800000"> <Product</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"VisioStdXVolume"</span><span style="color:#800000">></span>
<span style="color:#800000"> <Language</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"fr-fr"</span><span style="color:#000000"> </span><span style="color:#ff0000">FallBack</span><span style="color:#000000">=</span><span style="color:#0000ff">"en-US"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> </Product></span>
<span style="color:#800000"> <Product</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"O365ProPlusRetail"</span><span style="color:#800000">></span>
<span style="color:#800000"> <ExcludeApp</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"onedrive"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> <Language</span><span style="color:#000000"> </span><span style="color:#ff0000">ID</span><span style="color:#000000">=</span><span style="color:#0000ff">"fr-fr"</span><span style="color:#000000"> </span><span style="color:#ff0000">FallBack</span><span style="color:#000000">=</span><span style="color:#0000ff">"en-US"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"> </Product></span>
<span style="color:#800000"> </Add></span>
<span style="color:#800000"> <Logging</span><span style="color:#000000"> </span><span style="color:#ff0000">Level</span><span style="color:#000000">=</span><span style="color:#0000ff">"Standard"</span><span style="color:#000000"> </span><span style="color:#ff0000">Path</span><span style="color:#000000">=</span><span style="color:#0000ff">"C:\InstallationLogs\Office365"</span><span style="color:#000000"> </span><span style="color:#800000">/></span>
<span style="color:#800000"></Configuration></span></pre></div>
</td>
</tr>
</tbody>
</table>
<p>Une fois la nouvelle configuration générée, elle est appliquée en utilisant le programme d'installation standard d'Office 365.</p>
<h2>Paramètres d'exécution</h2>
<p>Les paramètres du script sont les suivants :</p>
<ul>
<li>liste de composants à ajouter</li>
<li>liste de composants à supprimer</li>
<li>liste de produits à ajouter</li>
<li>liste de produits à supprimer</li>
<li>liste de langues d'interface à ajouter</li>
<li>indicateur de suppression de contrôle de version</li>
<li>localisation du dossier comportant le programme Setup.exe d'Office 365</li>
<li>localisation du dossier comportant les fichiers sources d'Office 365</li>
</ul>
<h3>Composants & Produits</h3>
<p>Les composants gérés sont : Access, Excel, Groove, Lync, OneDrive, OneNote, Outlook, PowerPoint, Publisher, Word, Bing.</p>
<p>Les produits gérés sont : ProjectProXVolume, ProjectStdXVolume, ProjectProRetail, ProjectStdRetail, VisioProXVolume, VisioStdXVolume, VisioStdRetail, VisioProRetail,AccessRuntimeRetail.</p>
<p>Ces listes peuvent être étendues pour ajouter de nouveaux produits si nécessaire.</p>
<h3>Gestion des langues</h3>
<p>Si aucun paramètre spécifique n'est indiqué, les langues déjà présents sur le poste sont reconduites, et la langue par défaut d'Office est conservée.</p>
<p>Dans le cas contraire, les langues à installer doivent être indiquées en précisant leur code (suivant la notification IETF), la première entrée de la liste indiquant alors la langue par défaut d'Office après reconfiguration.</p>
<p>Pour les produits ajoutés, si aucun paramètre de langue n'est précisé, la langue par défaut est alors celle du système d'exploitaiton, avec un repli sur en-US en cas d'indisponibilité.</p>
<p>Dans tous les cas, une langue ne peut être ajoutée que si elle est présente dans les fichiers sources fournis.</p>
<h3>Gestion des versions</h3>
<p>Le principal problème pouvant survenir lors de la réinstallation d'Office 365 est qu'il est possible de faire un retour arrière sur le niveau de version très facilement, le programme d'installation ne contrôlant pas actuellement ce point.</p>
<p>Lors de la détermination de la configuration installée, le script détermine la version présente.</p>
<p>Par défaut, si la version installée est différente de la version fournie dans les soures, l'installation n'a pas lieu.</p>
<p>Si le drapeau de suppression de contrôle de version est levé, le contrôle de version n'a pas lieu et l'installation se fera avec la version présente dans les sources, permettant alors une montée ou descente de version, suivant le cas.</p>
<h3>Programme d'installation d'Office 365</h3>
<p>Le programme Setup.exe destiné à l'installation d'Office 365 évolue indépendamment des sources d'Office (nouvelles fonctionnalités, corrections d'erreurs, ...).</p>
<p>Par défaut, le script le recherchera dans le dossier des sources, ou dans le dossier précisé en paramètre.</p>
<p>Si aucun programme n'est trouvé, l'installation ne pourra pas avoir lieu.</p>
<h3>Sources d'Office 365</h3>
<p>Le paramètre spécifiant la localisation des sources est obligatoire pour procéder à l'installation.</p>
<p>Un contrôle minimal est effectué sur son contenu (présence d'un dossier portant le n° de version d'Office).</p>
<p>Si la localisation n'est pas fournie ou si le contrôle échoue, l'installation ne pourra pas avoir lieu.</p>
<p> </p>
</div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">03/02/2019 - 20:23</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">28/01/2020 - 13:30</div></div></section><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/tags/office-365" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Office 365</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/2" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Outils</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/15" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Poste de travail</a></li></ul></section>Sun, 03 Feb 2019 19:23:52 +0000Roland Danard29 at http://danard.nethttp://danard.net/content/office-365-reconfiguration-apr%C3%A8s-installation-initiale#commentsSuppression d'applications Windows 10
http://danard.net/content/suppression-dapplications-windows-10
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Supprimer les applications Windows 10 présentes sur un poste de travail n'est pas toujours des plus simple, étant donné qu'elles sont installées d'une part dans un magasin logiciel local, puis dans l'espace utilisateur.<br />Sans compter certaines (fournies avec Windows) qui, bien que visibles dans "Applications et fonctionnalités", ne peuvent être désinstallées depuis ce panneau de configuration...</p>
<p>Le script ci-dessous a pour objet de répondre au besoin de désinstaller ces applications intégrées.</p>
<p>La liste des noms d'applications pouvant être désinstallées par cette méthode est obtenue par la commande PowerShell (à exécuter avec les privilèges d'administrateur) :</p>
<pre>(Get-ProvisionedAppxPackage -Online).DisplayName</pre><p>Il n'y a pas de moyen simple en PowerShell d'obtenir la correspondance entre le nom de l'application obtenu par la commande précédente et le nom affiché dans "Applications et fonctionnalités", ceux-ci étant affichés dans la langue de l'utilisateur (et accessoirement parce qu'il y a un certain manque de cohérence dans les données fournies dans les fichiers 'manifest' des applications). Une liste est disponible ici : <a href="https://docs.microsoft.com/en-us/windows/application-management/apps-in-windows-10">https://docs.microsoft.com/en-us/windows/application-management/apps-in-windows-10</a>. Les applications supprimables par le script sont celles de la liste "Provisioned Windows Apps".</p>
<p>Le script doit être exécuté avec un compte disposant des droits d'administration locale.</p>
<p>Une fois désinstallées, à partir de Windows 1703, les applications ne sont pas réinstallées lors d'une mise à niveau vers une version plus récente du système.</p>
<p>Elles ne peuvent être réinstallées que depuis le Microsoft Store.</p>
<p> </p>
<hr />
<pre> </pre><div style="color: #000000;background-color: #ffffff;font-family: 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
<pre><span style="color: #0000ff;">function</span><span style="color: #000000;"> </span><span style="color: #795e26;">Remove-WindowsApps</span><span style="color: #000000;"> {</span>
<span style="color: #008000;"><#</span>
<span style="color: #008000;"> .</span><span style="color: #000000;">SYNOPSIS</span>
<span style="color: #008000;"> Remove Windows Apps based on a list</span>
<span style="color: #008000;"> .</span><span style="color: #000000;">DESCRIPTION</span>
<span style="color: #008000;"> Fully remove a list of Windows Apps, for new users or existing users profiles</span>
<span style="color: #008000;"> .</span><span style="color: #000000;">PARAMETER</span><span style="color: #008000;"> </span><span style="color: #000000;">AppName</span>
<span style="color: #008000;"> Name of application to remove, or list of application names to remove</span>
<span style="color: #008000;"> .</span><span style="color: #000000;">EXAMPLE</span>
<span style="color: #008000;"> Remove-WindowsApps -AppName Microsoft.Getstarted</span>
<span style="color: #008000;"> .</span><span style="color: #000000;">EXAMPLE</span>
<span style="color: #008000;"> Remove-WindowsApps -AppName @("Microsoft.Getstarted","Microsoft.People")</span>
<span style="color: #008000;">#></span>
<span style="color: #000000;"> [</span><span style="color: #795e26;">CmdletBinding</span><span style="color: #000000;">()]</span>
<span style="color: #af00db;"> Param</span>
<span style="color: #000000;"> (</span>
<span style="color: #000000;"> [</span><span style="color: #795e26;">Parameter</span><span style="color: #000000;">(</span><span style="color: #001080;">Mandatory</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">$true</span><span style="color: #000000;">)]</span>
<span style="color: #000000;"> [</span><span style="color: #0000ff;">string</span><span style="color: #000000;">[]]</span><span style="color: #001080;">$AppName</span>
<span style="color: #000000;"> )</span>
<span style="color: #af00db;"> Foreach</span><span style="color: #000000;"> (</span><span style="color: #001080;">$app</span><span style="color: #000000;"> </span><span style="color: #af00db;">in</span><span style="color: #000000;"> </span><span style="color: #001080;">$AppName</span><span style="color: #000000;">) {</span>
<span style="color: #008000;"> # remove from provisionned application list</span>
<span style="color: #af00db;"> try</span><span style="color: #000000;"> {</span>
<span style="color: #001080;"> $winApp</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #795e26;">Get-ProvisionedAppxPackage</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;">Online </span><span style="color: #000000;">|</span><span style="color: #000000;"> </span><span style="color: #795e26;">Where-Object</span><span style="color: #000000;"> {$_</span><span style="color: #001080;">.DisplayName</span><span style="color: #000000;"> </span><span style="color: #000000;">-eq</span><span style="color: #000000;"> </span><span style="color: #001080;">$app</span><span style="color: #000000;">}</span>
<span style="color: #af00db;"> if</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">$null</span><span style="color: #000000;"> </span><span style="color: #000000;">-ne</span><span style="color: #000000;"> </span><span style="color: #001080;">$winApp</span><span style="color: #000000;">) {</span>
<span style="color: #795e26;"> Remove-ProvisionedAppxPackage</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;">Online </span><span style="color: #000000;">-</span><span style="color: #000000;">PackageName </span><span style="color: #001080;">$winApp.PackageName</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;">ErrorAction Stop </span><span style="color: #000000;">|</span><span style="color: #000000;"> </span><span style="color: #795e26;">Out-Null</span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #a31515;">"</span><span style="color: #001080;">$app</span><span style="color: #a31515;"> - Windows Provisioned Application removed"</span><span style="color: #000000;"> </span>
<span style="color: #000000;"> } </span><span style="color: #af00db;">else</span><span style="color: #000000;"> {</span>
<span style="color: #795e26;"> Write-Host </span><span style="color: #a31515;">"</span><span style="color: #001080;">$app</span><span style="color: #a31515;"> - not found"</span><span style="color: #000000;"> </span>
<span style="color: #000000;"> }</span>
<span style="color: #000000;"> } </span>
<span style="color: #af00db;"> catch</span><span style="color: #000000;"> {</span>
<span style="color: #001080;"> $err</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> $_</span><span style="color: #001080;">.Exception.Message</span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #a31515;">"Error while removing '</span><span style="color: #001080;">$app</span><span style="color: #a31515;">' Windows Provisioned Application"</span><span style="color: #000000;"> </span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #001080;">$err</span>
<span style="color: #000000;"> }</span>
<span style="color: #008000;"> # remove package for users already connected to the computer</span>
<span style="color: #af00db;"> try</span><span style="color: #000000;"> {</span>
<span style="color: #001080;"> $winPkg</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #795e26;">Get-AppxPackage</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;">AllUsers </span><span style="color: #001080;">$app</span><span style="color: #000000;"> </span>
<span style="color: #af00db;"> if</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">$null</span><span style="color: #000000;"> </span><span style="color: #000000;">-ne</span><span style="color: #000000;"> </span><span style="color: #001080;">$winPkg</span><span style="color: #000000;">) {</span>
<span style="color: #795e26;"> Remove-AppxPackage</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;">Package </span><span style="color: #001080;">$winPkg</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;">AllUsers </span><span style="color: #000000;">-</span><span style="color: #000000;">ErrorAction Stop </span><span style="color: #000000;">|</span><span style="color: #000000;"> </span><span style="color: #795e26;">Out-Null</span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #a31515;">"</span><span style="color: #001080;">$app</span><span style="color: #a31515;"> - Windows Application removed"</span>
<span style="color: #000000;"> }</span> <span style="color: #af00db;">else</span><span style="color: #000000;"> {</span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #a31515;">"</span><span style="color: #001080;">$app</span><span style="color: #a31515;"> - Appx Package not found"</span><span style="color: #000000;"> </span>
<span style="color: #000000;"> }</span>
<span style="color: #000000;"> }</span>
<span style="color: #af00db;"> catch</span><span style="color: #000000;"> {</span>
<span style="color: #001080;"> $err</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> $_</span><span style="color: #001080;">.Exception.Message</span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #a31515;">"Error while removing '</span><span style="color: #001080;">$app</span><span style="color: #a31515;">' Windows Application"</span>
<span style="color: #795e26;"> Write-Host</span><span style="color: #000000;"> </span><span style="color: #001080;">$err</span>
<span style="color: #000000;"> }</span>
<span style="color: #000000;"> }</span>
<span style="color: #000000;">}</span></pre></div>
<pre> </pre></div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">10/12/2018 - 21:08</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">12/01/2019 - 15:45</div></div></section><div class="field field-name-field-file field-type-file field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even"><span class="file"><img class="file-icon" alt="Icône paquet" title="application/zip" src="/modules/file/icons/package-x-generic.png" /> <a href="http://danard.net/sites/default/files/download/Remove-WindowsApps.zip" type="application/zip; length=812">Remove-WindowsApps.zip</a></span></div></div></div><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/8" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Windows</a></li><li class="field-item even" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li></ul></section>Mon, 10 Dec 2018 20:08:07 +0000Roland Danard28 at http://danard.nethttp://danard.net/content/suppression-dapplications-windows-10#commentsAffichage de notification
http://danard.net/content/affichage-de-notification
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Le but de cette fonction Powershell est d'afficher un message à l'utilisateur pendant l'exécution d'un script.</p>
<p>Suivant le système d'exploitation, le résultat sera différent :</p>
<ul>
<li>Windows 7 : affichage dans la zone des icones de notification</li>
<li>Windows 10 : affichage dans la zone des icones de notification et dans le Centre de notitication</li>
</ul>
<p>La fonction utilise une variable externe, déclarée au niveau du script, pour stocker l'objet "NotifyIcon" utilisé pour l'affichage. Cette variable doit être initialisée à $null avant le premier appel à la fonction (vu qu'il n'est pas possible de passer en paramètre une variable valorisée à $null).</p>
<hr />
<div style="color: #000000;background-color: #ffffff;font-family: 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
<pre>
<span style="color:#0000ff">function</span><span style="color:#000000"> </span><span style="color:#795e26">Show-Notification</span><span style="color:#000000"> {</span>
<span style="color:#008000"><#</span>
<span style="color:#008000"> .</span><span style="color:#000000">SYNOPSIS</span>
<span style="color:#008000"> Display a notification message in the notification area.</span>
<span style="color:#008000"> .</span><span style="color:#000000">DESCRIPTION</span>
<span style="color:#008000"> Displays a notification message, with customizable text, title, system tray icon and message icon.</span>
<span style="color:#008000"> .</span><span style="color:#000000">PARAMETER</span><span style="color:#008000"> </span><span style="color:#000000">Message</span>
<span style="color:#008000"> Text to display</span>
<span style="color:#008000"> .</span><span style="color:#000000">PARAMETER</span><span style="color:#008000"> </span><span style="color:#000000">Title</span>
<span style="color:#008000"> The title for the message balloon.</span>
<span style="color:#008000"> .</span><span style="color:#000000">PARAMETER</span><span style="color:#008000"> </span><span style="color:#000000">MessageType</span>
<span style="color:#008000"> The type of message. This value determines what type of icon to display. </span>
<span style="color:#008000"> Valid values are Info, Warning, Error, None.</span>
<span style="color:#008000"> .</span><span style="color:#000000">PARAMETER</span><span style="color:#008000"> </span><span style="color:#000000">SysTrayIcon</span>
<span style="color:#008000"> The path to a file that you will use as the system tray icon. </span>
<span style="color:#008000"> Default is the PowerShell ISE icon.</span>
<span style="color:#008000"> .</span><span style="color:#000000">PARAMETER</span><span style="color:#008000"> </span><span style="color:#000000">Duration</span>
<span style="color:#008000"> Message display duration, in milliseconds, default 10000 (10s)</span>
<span style="color:#008000"> .</span><span style="color:#000000">NOTES</span>
<span style="color:#008000"> A script variable $notifyIcon</span><span style="color:#001080"> </span><span style="color:#008000">needs to be defined beforehand, initialized at $null before the first call.</span>
<span style="color:#008000">#></span>
<span style="color:#000000"> [</span><span style="color:#795e26">CmdletBinding</span><span style="color:#000000">()]</span>
<span style="color:#af00db"> Param </span><span style="color:#000000">(</span>
<span style="color:#000000"> [</span><span style="color:#795e26">Parameter</span><span style="color:#000000">(</span><span style="color:#001080">Mandatory</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#0000ff">$true</span><span style="color:#000000">)]</span>
<span style="color:#001080"> $Message</span><span style="color:#000000">,</span>
<span style="color:#000000"> [</span><span style="color:#795e26">Parameter</span><span style="color:#000000">(</span><span style="color:#001080">Mandatory</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#0000ff">$true</span><span style="color:#000000">)]</span>
<span style="color:#001080"> $Title</span><span style="color:#000000">,</span>
<span style="color:#000000"> [</span><span style="color:#795e26">Parameter</span><span style="color:#000000">(</span><span style="color:#001080">Mandatory</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#0000ff">$false</span><span style="color:#000000">)]</span>
<span style="color:#001080"> $IconPath</span><span style="color:#000000">,</span>
<span style="color:#000000"> </span>
<span style="color:#000000"> [</span><span style="color:#795e26">Parameter</span><span style="color:#000000">(</span><span style="color:#001080">Mandatory</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#0000ff">$false</span><span style="color:#000000">)]</span>
<span style="color:#000000"> [</span><span style="color:#795e26">ValidateSet</span><span style="color:#000000">(</span><span style="color:#a31515">'None'</span><span style="color:#000000">,</span><span style="color:#000000"> </span><span style="color:#a31515">'Info'</span><span style="color:#000000">,</span><span style="color:#000000"> </span><span style="color:#a31515">'Warning'</span><span style="color:#000000">,</span><span style="color:#000000"> </span><span style="color:#a31515">'Error'</span><span style="color:#000000">)]</span>
<span style="color:#001080"> $MessageType</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#a31515">'Info'</span><span style="color:#000000">,</span>
<span style="color:#000000"> [</span><span style="color:#795e26">Parameter</span><span style="color:#000000">(</span><span style="color:#001080">Mandatory</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#0000ff">$false</span><span style="color:#000000">)]</span>
<span style="color:#001080"> $Timeout</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#09885a">10000</span>
<span style="color:#000000"> )</span>
<span style="color:#795e26"> Add-Type</span><span style="color:#000000"> </span><span style="color:#000000">-</span><span style="color:#000000">AssemblyName System.Windows.Forms</span>
<span style="color:#af00db"> if</span><span style="color:#000000"> (</span><span style="color:#0000ff">$null</span><span style="color:#000000"> </span><span style="color:#000000">-eq</span><span style="color:#000000"> </span><span style="color:#001080">$</span><span style="color:#0000ff">script</span><span style="color:#001080">:notifyIcon</span><span style="color:#000000">) {</span>
<span style="color:#001080"> $</span><span style="color:#0000ff">script</span><span style="color:#001080">:notifyIcon </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#795e26">New-Object</span><span style="color:#000000"> System.Windows.Forms.NotifyIcon</span>
<span style="color:#000000"> }</span>
<span style="color:#af00db"> if</span><span style="color:#000000"> (</span><span style="color:#0000ff">$null</span><span style="color:#000000"> </span><span style="color:#000000">-eq</span><span style="color:#000000"> </span><span style="color:#001080">$IconPath</span><span style="color:#000000">) {</span>
<span style="color:#001080"> $IconPath</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#795e26">Get-Process</span><span style="color:#000000"> </span><span style="color:#000000">-</span><span style="color:#000000">id $pid </span><span style="color:#000000">|</span><span style="color:#000000"> </span><span style="color:#795e26">Select-Object</span><span style="color:#000000"> </span><span style="color:#000000">-</span><span style="color:#000000">ExpandProperty Path</span>
<span style="color:#000000"> }</span>
<span style="color:#001080"> $notifyIcon.Icon</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> [</span><span style="color:#0000ff">System.Drawing.Icon</span><span style="color:#000000">]::ExtractAssociatedIcon(</span><span style="color:#001080">$IconPath</span><span style="color:#000000">)</span>
<span style="color:#001080"> $notifyIcon.BalloonTipIcon</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#001080">$MessageType</span>
<span style="color:#001080"> $notifyIcon.BalloonTipText</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#001080">$Message</span>
<span style="color:#001080"> $notifyIcon.BalloonTipTitle</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#001080">$Title</span>
<span style="color:#001080"> $notifyIcon.Visible</span><span style="color:#000000"> </span><span style="color:#000000">=</span><span style="color:#000000"> </span><span style="color:#0000ff">$true</span>
<span style="color:#001080"> $notifyIcon.ShowBalloonTip</span><span style="color:#000000">(</span><span style="color:#001080">$Timeout</span><span style="color:#000000">)</span>
<span style="color:#000000">} </span></pre></div>
<pre>
</pre></div></div></div><section class="field field-name-post-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Date de publication: </h2><div class="field-items"><div class="field-item even">09/12/2018 - 20:07</div></div></section><section class="field field-name-changed-date field-type-ds field-label-inline clearfix view-mode-rss"><h2 class="field-label">Dernière modification: </h2><div class="field-items"><div class="field-item even">28/01/2020 - 12:55</div></div></section><section class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Tags: </h2><ul class="field-items"><li class="field-item even" rel="dc:subject"><a href="/tags/script" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Script</a></li><li class="field-item odd" rel="dc:subject"><a href="/tags/powershell" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">PowerShell</a></li><li class="field-item even" rel="dc:subject"><a href="/taxonomy/term/8" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Windows</a></li></ul></section>Sun, 09 Dec 2018 19:07:24 +0000Roland Danard27 at http://danard.nethttp://danard.net/content/affichage-de-notification#comments