<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AideXchange &#187; Powershell</title>
	<atom:link href="http://aidexchange.fr/tag/powershell/feed" rel="self" type="application/rss+xml" />
	<link>http://aidexchange.fr</link>
	<description>L&#039;administration avec PowerShell.</description>
	<lastBuildDate>Wed, 08 Feb 2012 10:47:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Activer l’éditeur PowerShell sur Windows 2008 R2</title>
		<link>http://aidexchange.fr/powershell/activer-editeur-powershell-sur-windows-2008-r2.html</link>
		<comments>http://aidexchange.fr/powershell/activer-editeur-powershell-sur-windows-2008-r2.html#comments</comments>
		<pubDate>Thu, 05 Jan 2012 18:35:18 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Edition]]></category>
		<category><![CDATA[ISE]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2781</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Par défaut, l’éditeur PowerShell ISE sur Windows 2008 R2 ou Seven qui possèdent nativement PowerShell V2 n&#8217;est pas accessible. Il faut l&#8217;installer. Rien à télécharger, tout est déja disponible en local. Il suffit juste de lancer la commande. Import-Module ServerManager;Add-WindowsFeature PowerShell-ISE Et comme par magie Powershell ISE apparait dans le menu démarrer. &#160; &#160; Il [...]
Related posts:<ol>
<li><a href='http://aidexchange.fr/active-directory/importer-les-cmdlets-active-directory-2008.html' rel='bookmark' title='Importer les cmdlets Active Directory 2008'>Importer les cmdlets Active Directory 2008</a></li>
<li><a href='http://aidexchange.fr/powershell/raccourcir-prompt-powershell.html' rel='bookmark' title='Raccourcir le prompt de Powershell.'>Raccourcir le prompt de Powershell.</a></li>
<li><a href='http://aidexchange.fr/powershell/utiliser-internet-explorer-avec-powershell.html' rel='bookmark' title='Utiliser Internet Explorer avec Powershell'>Utiliser Internet Explorer avec Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Par défaut, l’éditeur PowerShell ISE sur Windows 2008 R2 ou Seven qui possèdent nativement PowerShell V2 n&#8217;est pas accessible.<br />
Il faut l&#8217;installer. Rien à télécharger, tout est déja disponible en local. Il suffit juste de lancer la commande.</p>

<div class="wp_codebox"><table><tr id="p27812"><td class="code" id="p2781code2"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Import-Module</span> ServerManager;Add<span style="color: pink;">-</span>WindowsFeature PowerShell<span style="color: pink;">-</span>ISE</pre></td></tr></table></div>

<p>Et comme par magie Powershell ISE apparait dans le menu démarrer.<br />
&nbsp;<br />
<a href="http://img1.aidexchange.fr/wp-content/uploads/2012/01/PowerShell_ISE.png"><img class="aligncenter size-medium wp-image-2783" title="PowerShell_ISE" src="http://img1.aidexchange.fr/wp-content/uploads/2012/01/PowerShell_ISE-224x300.png" alt="" width="224" height="300" /></a></p>
<p>&nbsp;</p>
<p>Il vous permettra de faire en local vos petites modifications de script.<br />
&nbsp;<br />
<a href="http://img2.aidexchange.fr/wp-content/uploads/2012/01/PowerShell_ISE_Home1.png"><img class="aligncenter size-full wp-image-2786" title="PowerShell_ISE_Home" src="http://img2.aidexchange.fr/wp-content/uploads/2012/01/PowerShell_ISE_Home1.png" alt="" width="670" height="auto" /></a><br />
&nbsp;<br />
Pour les autres versions de Windows il faudra passer par l&#8217;installation de PowerShell V2.</p>
<p>Related posts:<ol>
<li><a href='http://aidexchange.fr/active-directory/importer-les-cmdlets-active-directory-2008.html' rel='bookmark' title='Importer les cmdlets Active Directory 2008'>Importer les cmdlets Active Directory 2008</a></li>
<li><a href='http://aidexchange.fr/powershell/raccourcir-prompt-powershell.html' rel='bookmark' title='Raccourcir le prompt de Powershell.'>Raccourcir le prompt de Powershell.</a></li>
<li><a href='http://aidexchange.fr/powershell/utiliser-internet-explorer-avec-powershell.html' rel='bookmark' title='Utiliser Internet Explorer avec Powershell'>Utiliser Internet Explorer avec Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/activer-editeur-powershell-sur-windows-2008-r2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variables d&#8217;environnement avec PowerShell</title>
		<link>http://aidexchange.fr/powershell/variables-environnement-avec-powershell.html</link>
		<comments>http://aidexchange.fr/powershell/variables-environnement-avec-powershell.html#comments</comments>
		<pubDate>Wed, 14 Dec 2011 08:39:23 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Variables d'environnement]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2670</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Voici comment utiliser les variables d&#8217;environnement avec PowerShell. Afficher les variables d&#8217;environnement: Get-ChildItem Env: Afficher une variable d&#8217;environnement: $Env:os Utiliser les variables d&#8217;environnement: Set-Location $env:USERPROFILE No related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Voici comment utiliser les variables d&#8217;environnement avec PowerShell.</p>
<p>Afficher les variables d&#8217;environnement:</p>

<div class="wp_codebox"><table><tr id="p26706"><td class="code" id="p2670code6"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Get-ChildItem</span> Env:</pre></td></tr></table></div>

<p>Afficher une variable d&#8217;environnement:</p>

<div class="wp_codebox"><table><tr id="p26707"><td class="code" id="p2670code7"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$Env</span>:os</pre></td></tr></table></div>

<p>Utiliser les variables d&#8217;environnement:</p>

<div class="wp_codebox"><table><tr id="p26708"><td class="code" id="p2670code8"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Set-Location</span> <span style="color: #800080;">$env</span>:USERPROFILE</pre></td></tr></table></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/variables-environnement-avec-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transfert vers un serveur FTP avec Powershell</title>
		<link>http://aidexchange.fr/powershell/transfert-vers-serveur-ftp-avec-powershell.html</link>
		<comments>http://aidexchange.fr/powershell/transfert-vers-serveur-ftp-avec-powershell.html#comments</comments>
		<pubDate>Mon, 31 Oct 2011 22:53:24 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Transfert]]></category>
		<category><![CDATA[Upload]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2472</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Voici un script PowerShell qui permet de transférer un dossier vers un serveur FTP. Ce script upload le dossier avec tous les sous dossiers et les fichiers. $user = &#34;guest&#34; $password = &#34;Powershell&#34; $localdir = &#34;C:\Scripts&#34; $ftpdir = &#34;ftp://ftp.server.com/uploads/&#34; &#160; $client = New-Object System.Net.WebClient $client.Credentials = New-Object System.Net.NetworkCredential&#40;$user,$password&#41; &#160; $parentfolder = $localdir.split&#40;&#34;\&#34;&#41;&#91;-1&#93; Write-Host &#34;Création de [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Voici un script <strong>PowerShell</strong> qui permet de transférer un dossier vers un serveur <strong>FTP</strong>.<br />
Ce script upload le dossier avec tous les sous dossiers et les fichiers.</p>

<div class="wp_codebox"><table><tr id="p247210"><td class="code" id="p2472code10"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$user</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;guest&quot;</span>
<span style="color: #800080;">$password</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Powershell&quot;</span>
<span style="color: #800080;">$localdir</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;C:\Scripts&quot;</span>
<span style="color: #800080;">$ftpdir</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;ftp://ftp.server.com/uploads/&quot;</span>
&nbsp;
<span style="color: #800080;">$client</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Net.WebClient 
<span style="color: #800080;">$client</span>.Credentials <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Net.NetworkCredential<span style="color: #000000;">&#40;</span><span style="color: #800080;">$user</span><span style="color: pink;">,</span><span style="color: #800080;">$password</span><span style="color: #000000;">&#41;</span> 
&nbsp;
<span style="color: #800080;">$parentfolder</span> <span style="color: pink;">=</span> <span style="color: #800080;">$localdir</span>.split<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;\&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: pink;">-</span><span style="color: #804000;">1</span><span style="color: #000000;">&#93;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Création de $parentfolder&quot;</span>
<span style="color: #800080;">$makedir</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Net.WebRequest<span style="color: #000000;">&#93;</span>::Create<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ftpdir</span><span style="color: pink;">+</span><span style="color: #800080;">$parentfolder</span><span style="color: #000000;">&#41;</span>;
<span style="color: #800080;">$makedir</span>.Credentials <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Net.NetworkCredential<span style="color: #000000;">&#40;</span><span style="color: #800080;">$user</span><span style="color: pink;">,</span><span style="color: #800080;">$password</span><span style="color: #000000;">&#41;</span> 
<span style="color: #800080;">$makedir</span>.Method <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Net.WebRequestMethods<span style="color: pink;">+</span>FTP<span style="color: #000000;">&#93;</span>::MakeDirectory;
<span style="color: #800080;">$makedir</span>.GetResponse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$item</span> <span style="color: #0000FF;">in</span> <span style="color: #008080; font-weight: bold;">Get-ChildItem</span> <span style="color: #008080; font-style: italic;">-recurse</span> <span style="color: #800080;">$localdir</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span> 
&nbsp;
    <span style="color: #800080;">$filename</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>system.io.path<span style="color: #000000;">&#93;</span>::GetFullPath<span style="color: #000000;">&#40;</span><span style="color: #800080;">$item</span>.FullName<span style="color: #000000;">&#41;</span>.SubString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>system.io.path<span style="color: #000000;">&#93;</span>::GetFullPath<span style="color: #000000;">&#40;</span><span style="color: #800080;">$localdir</span><span style="color: #000000;">&#41;</span>.Length <span style="color: pink;">+</span> <span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$item</span>.Attributes <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;Directory&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp;
        try<span style="color: #000000;">&#123;</span>
            <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Création de $item.Name&quot;</span>
&nbsp;
            <span style="color: #800080;">$makedir</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Net.WebRequest<span style="color: #000000;">&#93;</span>::Create<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ftpdir</span><span style="color: pink;">+</span><span style="color: #800000;">&quot;/&quot;</span><span style="color: pink;">+</span><span style="color: #800080;">$parentfolder</span><span style="color: pink;">+</span><span style="color: #800000;">&quot;/&quot;</span><span style="color: pink;">+</span><span style="color: #800080;">$filename</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #800080;">$makedir</span>.Credentials <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Net.NetworkCredential<span style="color: #000000;">&#40;</span><span style="color: #800080;">$user</span><span style="color: pink;">,</span><span style="color: #800080;">$password</span><span style="color: #000000;">&#41;</span> 
            <span style="color: #800080;">$makedir</span>.Method <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Net.WebRequestMethods<span style="color: pink;">+</span>FTP<span style="color: #000000;">&#93;</span>::MakeDirectory;
            <span style="color: #800080;">$makedir</span>.GetResponse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
            <span style="color: #000000;">&#125;</span>
            catch <span style="color: #000000;">&#91;</span>Net.WebException<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800080;">$item</span>.Name probably exists ...
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0000FF;">continue</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Transfert de $item...&quot;</span>
        <span style="color: #800080;">$file</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Uri<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ftpdir</span><span style="color: pink;">+</span><span style="color: #800000;">&quot;/&quot;</span><span style="color: pink;">+</span><span style="color: #800080;">$parentfolder</span><span style="color: pink;">+</span><span style="color: #800000;">&quot;/&quot;</span><span style="color: pink;">+</span><span style="color: #800080;">$filename</span><span style="color: #000000;">&#41;</span> 
        <span style="color: #800080;">$client</span>.UploadFile<span style="color: #000000;">&#40;</span><span style="color: #800080;">$file</span><span style="color: pink;">,</span> <span style="color: #800080;">$item</span>.FullName<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/transfert-vers-serveur-ftp-avec-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copier le résultat dans le press-papier</title>
		<link>http://aidexchange.fr/powershell/copier-le-resultat-d-une-commande-dans-le-press-papier.html</link>
		<comments>http://aidexchange.fr/powershell/copier-le-resultat-d-une-commande-dans-le-press-papier.html#comments</comments>
		<pubDate>Sun, 30 Oct 2011 21:44:31 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Commande]]></category>
		<category><![CDATA[Presse-Papier]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2430</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Pour copier le résultat d&#8217;une commande Powershell directement dans le presse-papier, il suffit de rajouter &#171;&#160;&#124; clip&#160;&#187; à la fin de celle-ci. Il de reste plus qu&#8217;à aller faire le coller ou vous le souhaitez. Get-ChildItem &#124; clip No related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Pour copier le résultat d&#8217;une commande <strong>Powershell</strong> directement dans le <strong>presse-papier</strong>, il suffit de rajouter &laquo;&nbsp;| clip&nbsp;&raquo; à la fin de celle-ci.<br />
Il de reste plus qu&#8217;à aller faire le coller ou vous le souhaitez.</p>

<div class="wp_codebox"><table><tr id="p243012"><td class="code" id="p2430code12"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Get-ChildItem</span> <span style="color: pink;">|</span> clip</pre></td></tr></table></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/copier-le-resultat-d-une-commande-dans-le-press-papier.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrouver la lettre d&#8217;un disque USB</title>
		<link>http://aidexchange.fr/powershell/retrouver-la-lettre-d-un-disque-usb.html</link>
		<comments>http://aidexchange.fr/powershell/retrouver-la-lettre-d-un-disque-usb.html#comments</comments>
		<pubDate>Sun, 30 Oct 2011 20:29:55 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Disque]]></category>
		<category><![CDATA[Lettre]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2426</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Dans votre profile, vous souhaitez vous connecter automatiquement à votre disque USB. Il peut arriver que la lettre change. Pour retrouver systématiquement la lettre de votre disque, voici un méthode. $drive = get-psdrive &#124; where-object &#123; $_.description -eq &#34;Disk Label&#34; &#125; Set-Location $drive.root No related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Dans votre profile, vous souhaitez vous connecter automatiquement à votre disque USB.<br />
Il peut arriver que la lettre change.<br />
Pour retrouver systématiquement la lettre de votre disque, voici un méthode.</p>

<div class="wp_codebox"><table><tr id="p242614"><td class="code" id="p2426code14"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$drive</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">get-psdrive</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-object</span> <span style="color: #000000;">&#123;</span> <a href="about:blank"><span style="color: #000080;">$_</span></a>.description <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;Disk Label&quot;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #008080; font-weight: bold;">Set-Location</span> <span style="color: #800080;">$drive</span>.root</pre></td></tr></table></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/retrouver-la-lettre-d-un-disque-usb.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ne garder que les derniers caractères d&#8217;une chaîne</title>
		<link>http://aidexchange.fr/powershell/ne-garder-les-derniers-caracteres-dune-chaine.html</link>
		<comments>http://aidexchange.fr/powershell/ne-garder-les-derniers-caracteres-dune-chaine.html#comments</comments>
		<pubDate>Thu, 20 Oct 2011 11:00:24 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Caractères]]></category>
		<category><![CDATA[Chaine]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2423</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Voici comment extraire les 8 derniers caractères d&#8217;une chaine. $log = &#34;sys000456.log&#34; $log.Substring&#40;$log.Length-8,8&#41; No related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Voici comment extraire les 8 derniers caractères d&#8217;une chaine.</p>

<div class="wp_codebox"><table><tr id="p242316"><td class="code" id="p2423code16"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$log</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;sys000456.log&quot;</span>
<span style="color: #800080;">$log</span>.Substring<span style="color: #000000;">&#40;</span><span style="color: #800080;">$log</span>.Length<span style="color: pink;">-</span><span style="color: #804000;">8</span><span style="color: pink;">,</span><span style="color: #804000;">8</span><span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/ne-garder-les-derniers-caracteres-dune-chaine.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Créer et modifier son profile Powershell</title>
		<link>http://aidexchange.fr/powershell/creer-modifier-son-profile-powershell.html</link>
		<comments>http://aidexchange.fr/powershell/creer-modifier-son-profile-powershell.html#comments</comments>
		<pubDate>Wed, 19 Oct 2011 23:53:05 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Fonctions]]></category>
		<category><![CDATA[Profile]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2410</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Chacun ces petites habitudes sous Powershell. Voici comment créer son profile et charger la configuration que l&#8217;on souhaite à l&#8217;ouverture de Powershell. Identifiez le chemin de votre profile. $profile Sous Windows Seven, le résultat devrait ressembler à &#8216;C:\Users\Christophe\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1&#8242; Vérifiez la présence du profile. Test-Path $profile Si la réponse et &#171;&#160;True&#160;&#187;, lancez: notepad $profile Si la réponse [...]
Related posts:<ol>
<li><a href='http://aidexchange.fr/powershell/supprimer-lignes-double-fichier.html' rel='bookmark' title='Supprimer les lignes en double dans un fichier.'>Supprimer les lignes en double dans un fichier.</a></li>
<li><a href='http://aidexchange.fr/powershell/gerer-fichiers-dossiers-powershell.html' rel='bookmark' title='Gérer les fichiers et dossiers avec Powershell.'>Gérer les fichiers et dossiers avec Powershell.</a></li>
<li><a href='http://aidexchange.fr/powershell/verifier-la-presence-d-un-dossier-avant-de-le-crer.html' rel='bookmark' title='Vérifier la présence d&#8217;un dossier avant de le créer'>Vérifier la présence d&#8217;un dossier avant de le créer</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Chacun ces petites habitudes sous Powershell.<br />
Voici comment créer son profile et charger la configuration que l&#8217;on souhaite à l&#8217;ouverture de <strong>Powershell</strong>.<br />
Identifiez le chemin de votre <strong>profile</strong>.</p>

<div class="wp_codebox"><table><tr id="p241021"><td class="code" id="p2410code21"><pre class="powershell" style="font-family:monospace;">$profile</pre></td></tr></table></div>

<p>Sous Windows Seven, le résultat devrait ressembler à &#8216;C:\Users\Christophe\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1&#8242;<br />
Vérifiez la présence du profile.</p>

<div class="wp_codebox"><table><tr id="p241022"><td class="code" id="p2410code22"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Test-Path</span> $profile</pre></td></tr></table></div>

<p>Si la réponse et &laquo;&nbsp;True&nbsp;&raquo;, lancez:</p>

<div class="wp_codebox"><table><tr id="p241023"><td class="code" id="p2410code23"><pre class="powershell" style="font-family:monospace;">notepad $profile</pre></td></tr></table></div>

<p>Si la réponse est &laquo;&nbsp;False&nbsp;&raquo;, il faut au préalable créer le fichier.</p>

<div class="wp_codebox"><table><tr id="p241024"><td class="code" id="p2410code24"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">New-Item</span> <span style="color: #008080; font-style: italic;">-Path</span> <span style="color: #800080;">$profile</span> <span style="color: pink;">-</span><span style="color: #008080; font-weight: bold;">Type</span> file <span style="color: #008080; font-style: italic;">-Force</span>
notepad $profile</pre></td></tr></table></div>

<p>Une fois dans le fichier, vous pouvez ajouter toutes les commandes que vous souhaitez exécuter à l&#8217;ouverture de Powershell.<br />
Exemple:<br />
<a href="http://img2.aidexchange.fr/wp-content/uploads/2011/10/profile.jpg"><img class="aligncenter size-full wp-image-2411" title="profile" src="http://img2.aidexchange.fr/wp-content/uploads/2011/10/profile.jpg" alt="" width="590" height="266" /></a><br />
Relancez Powershell pour admirer le résultat.</p>
<p>Related posts:<ol>
<li><a href='http://aidexchange.fr/powershell/supprimer-lignes-double-fichier.html' rel='bookmark' title='Supprimer les lignes en double dans un fichier.'>Supprimer les lignes en double dans un fichier.</a></li>
<li><a href='http://aidexchange.fr/powershell/gerer-fichiers-dossiers-powershell.html' rel='bookmark' title='Gérer les fichiers et dossiers avec Powershell.'>Gérer les fichiers et dossiers avec Powershell.</a></li>
<li><a href='http://aidexchange.fr/powershell/verifier-la-presence-d-un-dossier-avant-de-le-crer.html' rel='bookmark' title='Vérifier la présence d&#8217;un dossier avant de le créer'>Vérifier la présence d&#8217;un dossier avant de le créer</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/creer-modifier-son-profile-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utiliser Internet Explorer avec Powershell</title>
		<link>http://aidexchange.fr/powershell/utiliser-internet-explorer-avec-powershell.html</link>
		<comments>http://aidexchange.fr/powershell/utiliser-internet-explorer-avec-powershell.html#comments</comments>
		<pubDate>Wed, 19 Oct 2011 18:49:50 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2387</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Pour scripter des taches sur des sites web avec Internet Explorer. Voici quelques astuces. Tout d&#8217;abord lancer une page. $ie = New-Object -COMObject InternetExplorer.Application $ie.visible = $true $ie.Navigate&#40;'http://aidexchange.fr'&#41; While &#40;$ie.Busy&#41; &#123; Start-Sleep -Milliseconds 400 &#125; Afficher la liste des images $ie.document.getElementsByTagName&#40;'img'&#41; &#124; Select-Object -ExpandProperty src Afficher la liste des liens $ie.document.getElementsByTagName&#40;'a'&#41; &#124; Select-Object -ExpandProperty href [...]
Related posts:<ol>
<li><a href='http://aidexchange.fr/powershell/les-dimension-d-une-images-avec-powershell.html' rel='bookmark' title='Les dimensions d&#8217;une images avec Powershell'>Les dimensions d&#8217;une images avec Powershell</a></li>
<li><a href='http://aidexchange.fr/powershell/ajout-de-powershell-community-extensions.html' rel='bookmark' title='Ajout de &laquo;&nbsp;PowerShell Community Extensions&nbsp;&raquo;.'>Ajout de &laquo;&nbsp;PowerShell Community Extensions&nbsp;&raquo;.</a></li>
<li><a href='http://aidexchange.fr/powershell/export-de-powershell-vers-excel.html' rel='bookmark' title='Export de Powershell vers Excel.'>Export de Powershell vers Excel.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Pour scripter des taches sur des sites web avec Internet Explorer.<br />
Voici quelques astuces.</p>
<p>Tout d&#8217;abord lancer une page.</p>

<div class="wp_codebox"><table><tr id="p238731"><td class="code" id="p2387code31"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ie</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-COMObject</span> InternetExplorer.Application
<span style="color: #800080;">$ie</span>.visible <span style="color: pink;">=</span> <span style="color: #800080;">$true</span>
<span style="color: #800080;">$ie</span>.Navigate<span style="color: #000000;">&#40;</span><span style="color: #800000;">'http://aidexchange.fr'</span><span style="color: #000000;">&#41;</span>
<span style="color: #0000FF;">While</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$ie</span>.Busy<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #008080; font-weight: bold;">Start-Sleep</span> <span style="color: #008080; font-style: italic;">-Milliseconds</span> <span style="color: #804000;">400</span> <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Afficher la liste des images</p>

<div class="wp_codebox"><table><tr id="p238732"><td class="code" id="p2387code32"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ie</span>.document.getElementsByTagName<span style="color: #000000;">&#40;</span><span style="color: #800000;">'img'</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select-Object</span> <span style="color: #008080; font-style: italic;">-ExpandProperty</span> src</pre></td></tr></table></div>

<p>Afficher la liste des liens</p>

<div class="wp_codebox"><table><tr id="p238733"><td class="code" id="p2387code33"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ie</span>.document.getElementsByTagName<span style="color: #000000;">&#40;</span><span style="color: #800000;">'a'</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select-Object</span> <span style="color: #008080; font-style: italic;">-ExpandProperty</span> href</pre></td></tr></table></div>

<p>Cliquer sur un lien.</p>

<div class="wp_codebox"><table><tr id="p238734"><td class="code" id="p2387code34"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$link</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ie</span>.Document.getElementsByTagName<span style="color: #000000;">&#40;</span><span style="color: #800000;">'a'</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-object</span> <span style="color: #000000;">&#123;</span><a href="about:blank"><span style="color: #000080;">$_</span></a>.title <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">'Linkedin'</span><span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$link</span>.click<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

<p>Si vous souhaitez télécharger un document, une image ou un tout autre type de fichier, il faut charger le module &laquo;&nbsp;BitsTransfer&nbsp;&raquo; qui vous donnera accès a toute une série de cmdlets.</p>

<div class="wp_codebox"><table><tr id="p238735"><td class="code" id="p2387code35"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Import-Module</span> BitsTransfer
<span style="color: #008080; font-weight: bold;">Get-Command</span> <span style="color: pink;">-</span>Module BitsTransfer
&nbsp;
CommandType     Name                                                Definition
<span style="color: pink;">-----------</span>     <span style="color: pink;">----</span>                                                <span style="color: pink;">----------</span>
Cmdlet          Add<span style="color: pink;">-</span>BitsFile                                        Add<span style="color: pink;">-</span>BitsFile <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>BitsJob<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Source<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>V...
Cmdlet          Get<span style="color: pink;">-</span>BitsTransfer                                    Get<span style="color: pink;">-</span>BitsTransfer <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span><span style="color: #008080; font-style: italic;">-Name</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>AllUsers...
Cmdlet          Remove<span style="color: pink;">-</span>BitsTransfer                                 Remove<span style="color: pink;">-</span>BitsTransfer <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>BitsJob<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Ver...
Cmdlet          Resume<span style="color: pink;">-</span>BitsTransfer                                 Resume<span style="color: pink;">-</span>BitsTransfer <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>BitsJob<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Asy...
Cmdlet          Set<span style="color: pink;">-</span>BitsTransfer                                    Set<span style="color: pink;">-</span>BitsTransfer <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>BitsJob<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Displa...
Cmdlet          Start<span style="color: pink;">-</span>BitsTransfer                                  Start<span style="color: pink;">-</span>BitsTransfer <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Source<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Desti...
Cmdlet          Suspend<span style="color: pink;">-</span>BitsTransfer                                Suspend<span style="color: pink;">-</span>BitsTransfer <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>BitsJob<span style="color: #000000;">&#93;</span>  <span style="color: #000000;">&#91;</span><span style="color: pink;">-</span>Ve...</pre></td></tr></table></div>

<p>Et donc pour télécharger un document.</p>

<div class="wp_codebox"><table><tr id="p238736"><td class="code" id="p2387code36"><pre class="powershell" style="font-family:monospace;">Start<span style="color: pink;">-</span>BitsTransfer <span style="color: pink;">-</span>Source <span style="color: #800000;">'http://aidexchange.fr/plus.png'</span> <span style="color: #008080; font-style: italic;">-Destination</span> <span style="color: #800000;">'c:\images\'</span></pre></td></tr></table></div>

<p>Avec tous ces éléments il est possible de scripter le téléchargement quotidien d&#8217;un fichier sur un site web, le téléchargement rapide toutes les images d&#8217;une page ou toute autres idées tordues.<br />
<a href="http://powershell.com/cs/blogs/tobias/archive/2010/03/17/downloading-images-from-webpages.aspx" target="_blank">D&#8217;autres infos.</a></p>
<p>Related posts:<ol>
<li><a href='http://aidexchange.fr/powershell/les-dimension-d-une-images-avec-powershell.html' rel='bookmark' title='Les dimensions d&#8217;une images avec Powershell'>Les dimensions d&#8217;une images avec Powershell</a></li>
<li><a href='http://aidexchange.fr/powershell/ajout-de-powershell-community-extensions.html' rel='bookmark' title='Ajout de &laquo;&nbsp;PowerShell Community Extensions&nbsp;&raquo;.'>Ajout de &laquo;&nbsp;PowerShell Community Extensions&nbsp;&raquo;.</a></li>
<li><a href='http://aidexchange.fr/powershell/export-de-powershell-vers-excel.html' rel='bookmark' title='Export de Powershell vers Excel.'>Export de Powershell vers Excel.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/utiliser-internet-explorer-avec-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Supprimer les photos en portrait</title>
		<link>http://aidexchange.fr/powershell/supprimer-les-photos-en-portrait.html</link>
		<comments>http://aidexchange.fr/powershell/supprimer-les-photos-en-portrait.html#comments</comments>
		<pubDate>Tue, 18 Oct 2011 22:34:24 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Suppression]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2384</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Je n&#8217;aime pas le photos prise en portrait. A chacun ces goûts. Voici le moyen que j&#8217;ai trouver pour toutes les supprimer d&#8217;un coup. $image = New-Object -ComObject Wia.ImageFile Get-ChildItem -Recurse -Include *.jpg -Path &#34;..\images&#34; &#124; foreach &#123; $file = $_.fullname $image.LoadFile&#40;$file&#41; if &#40; $image.Width -gt $image.Height&#41; &#123; Remove-Item -Path $file -Force &#125; &#125; No [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Je n&#8217;aime pas le photos prise en portrait. A chacun ces goûts.<br />
Voici le moyen que j&#8217;ai trouver pour toutes les supprimer d&#8217;un coup.</p>

<div class="wp_codebox"><table><tr id="p238438"><td class="code" id="p2384code38"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$image</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-ComObject</span> Wia.ImageFile
<span style="color: #008080; font-weight: bold;">Get-ChildItem</span> <span style="color: #008080; font-style: italic;">-Recurse</span> <span style="color: #008080; font-style: italic;">-Include</span> <span style="color: pink;">*</span>.jpg <span style="color: #008080; font-style: italic;">-Path</span> <span style="color: #800000;">&quot;..\images&quot;</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$file</span> <span style="color: pink;">=</span> <a href="about:blank"><span style="color: #000080;">$_</span></a>.fullname
<span style="color: #800080;">$image</span>.LoadFile<span style="color: #000000;">&#40;</span><span style="color: #800080;">$file</span><span style="color: #000000;">&#41;</span>
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #800080;">$image</span>.Width <span style="color: #FF0000;">-gt</span> <span style="color: #800080;">$image</span>.Height<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-weight: bold;">Remove-Item</span> <span style="color: #008080; font-style: italic;">-Path</span> <span style="color: #800080;">$file</span> <span style="color: #008080; font-style: italic;">-Force</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/supprimer-les-photos-en-portrait.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vérifier la présence d&#8217;un dossier avant de le créer</title>
		<link>http://aidexchange.fr/powershell/verifier-la-presence-d-un-dossier-avant-de-le-crer.html</link>
		<comments>http://aidexchange.fr/powershell/verifier-la-presence-d-un-dossier-avant-de-le-crer.html#comments</comments>
		<pubDate>Tue, 18 Oct 2011 14:21:51 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Dossier]]></category>

		<guid isPermaLink="false">http://aidexchange.fr/?p=2379</guid>
		<description><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/>Une petite ligne rapide pour tester la présence d&#8217;un dossier et le créer si absent. If &#40;-not &#40;Test-Path &#34;dossier_test&#34;&#41;&#41; &#123; New-Item -ItemType Directory -Name &#34;dossier_test&#34; &#125; No related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://aidexchange.fr/wp-content/plugins/category-icons/icons/Powershell.png" width="70" height="70" alt="" title="Powershell" /><br/><p>Une petite ligne rapide pour tester la présence d&#8217;un dossier et le créer si absent.</p>

<div class="wp_codebox"><table><tr id="p237940"><td class="code" id="p2379code40"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">-not</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Test-Path</span> <span style="color: #800000;">&quot;dossier_test&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #008080; font-weight: bold;">New-Item</span> <span style="color: #008080; font-style: italic;">-ItemType</span> Directory <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;dossier_test&quot;</span> <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://aidexchange.fr/powershell/verifier-la-presence-d-un-dossier-avant-de-le-crer.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

