<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.mazinger.fr/wiki/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.mazinger.fr/wiki/feed.php">
        <title>My Personal Wiki - windows:powershell</title>
        <description>La théorie, c'est quand on sait tout et que rien ne fonctionne....                                                           La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi.</description>
        <link>https://wiki.mazinger.fr/wiki/</link>
        <image rdf:resource="https://wiki.mazinger.fr/wiki/lib/exe/fetch.php?media=wiki:logo.png" />
       <dc:date>2026-04-26T23:53:31+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:dsc&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:execscript&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:get-adorganizationalunit&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:getaddomain_forest&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:getchild-item&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:last-login&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:lister-users-desactive&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:lister-users-groupe-ad&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:profile&amp;rev=1709466960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:superscript&amp;rev=1709466960&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.mazinger.fr/wiki/lib/exe/fetch.php?media=wiki:logo.png">
        <title>My Personal Wiki</title>
        <link>https://wiki.mazinger.fr/wiki/</link>
        <url>https://wiki.mazinger.fr/wiki/lib/exe/fetch.php?media=wiki:logo.png</url>
    </image>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:dsc&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>dsc</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:dsc&amp;rev=1709466960&amp;do=diff</link>
        <description>DSC et Fichier MOF

----------

Il est possible de décrire une configuration et d’être assuré de son application au travers de PowerShell DSC, permettant ainsi de déployer des serveurs, voire des ensembles de serveurs uniquement en ligne de commande.</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:execscript&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>execscript</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:execscript&amp;rev=1709466960&amp;do=diff</link>
        <description>Set-ExecutionPolicy

----------

Attention: il sera necéssaire d'ouvrir l'invite de commande en tant qu'administrateur

Commande

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine


Valider par “T”  


----------</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:get-adorganizationalunit&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>get-adorganizationalunit</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:get-adorganizationalunit&amp;rev=1709466960&amp;do=diff</link>
        <description>Get-ADOrganizationalUnit

----------

Script

Voici le bout de script qui vous donnera la réponse 


$TAB=@()
Get-ADOrganizationalUnit -Filter * | %{
	$OU = New-Object System.Object
	$OU | Add-Member -type NoteProperty -name OU -value $_.DistinguishedName
	$OU | Add-Member -type NoteProperty -name NBUser -value (@(Get-ADUser -Filter * -SearchBase $_.DistinguishedName -SearchScope 1  ).count)
	$TAB+=$OU
	}
$TAB | Out-File -FilePath ADCount.txt</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:getaddomain_forest&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>getaddomain_forest</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:getaddomain_forest&amp;rev=1709466960&amp;do=diff</link>
        <description>GetADDomain &amp; Forest

----------

Version AD

 Pour connaitre la version d'un Active Directory
(Get-ADDomain).DomainMode

Version Forêt
(Get-ADForest).ForestMode

----------

 --- sylvain 2020/02/20 15:40</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:getchild-item&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>getchild-item</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:getchild-item&amp;rev=1709466960&amp;do=diff</link>
        <description>GetChild-Item

----------

Détails de la commande PS: 

Explication: 

La commande va rechercher dans I: en mode récursif tout les répertoires nommés Perso ou perso, avec sortie des resultats dans un log.
Get-ChildItem -Path I:\ -Force -Recurse | Where-Object {$_.name -eq &quot;PERSO&quot; -or $_.name -eq &quot;perso&quot;} &gt;&gt; c:\log.hzc</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:last-login&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>last-login</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:last-login&amp;rev=1709466960&amp;do=diff</link>
        <description>GetADUser

----------

Last LOGIN

Connaitre la dernière fois qu'un utilisateur c'est authentifier dans votre domaine


Get-ADUser -Filter {Enabled -eq $true} -Properties Name,Manager,LastLogon | 
Select-Object Name,Manager,@{n='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon)}} &gt; c:\LastLogin.txt</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:lister-users-desactive&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>lister-users-desactive</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:lister-users-desactive&amp;rev=1709466960&amp;do=diff</link>
        <description>GetADUsers

----------

Script


Import-Module ActiveDirectory
$Domaine = &quot;mon.domaine.com&quot; 
$JourInactivite = 15 
$Date = (Get-Date).Adddays(-($JourInactivite))
$ListeOrdinateur = Get-ADUser -Filter {LastLogonTimeStamp -lt $Date -and enabled -eq $true} -Properties LastLogonTimeStamp
$ListeOrdinateur.Count
Set-Content count.txt $ListeOrdinateur</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:lister-users-groupe-ad&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>lister-users-groupe-ad</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:lister-users-groupe-ad&amp;rev=1709466960&amp;do=diff</link>
        <description>GetADGroupMember

----------

Supposons que dans votre Active Directory vous avez un groupe “grp_Finance” 

et que vous souhaitez connaitre ces membres via PowerShell. 


Recherche


 Get-ADGroupMember -Identity 'grp_Finance' -Recursive | Select-Object name</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:profile&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>profile</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:profile&amp;rev=1709466960&amp;do=diff</link>
        <description>Creer Profile PowerShell

----------

Contrôle

 Commande qui permet de contrôler si un profil est déjà présent  


test-path $PROFILE

retour:  


False


Il faudra en créer un qui se situera dans “c:Users\UserName\Documents\WindowsPowershell\</description>
    </item>
    <item rdf:about="https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:superscript&amp;rev=1709466960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-03T11:56:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>superscript</title>
        <link>https://wiki.mazinger.fr/wiki/doku.php?id=windows:powershell:superscript&amp;rev=1709466960&amp;do=diff</link>
        <description>SUPER SCRIPT PowerShell Tools

----------

Présentation



Code Sources



#Modification du Prompt de ma console
function prompt 
{
    Write-Host (’PS ’ + $(Get-Location) + $(get-date -DisplayHint time) +’&gt;’) `
-NoNewLine -ForegroundColor Cyan
    ’ ’
}
#Modificationde la couleur de fond
$host.ui.RawUI.BackGroundColor = ’black’ # Couleur du fond
#Modification du titre de ma console
$host.ui.RawUI.WindowTitle = ’MA CONSOLE PERSO POWER SHELL V2’
#Rôle utilisateur
$UserType = ’Utilisateur’
$Curren…</description>
    </item>
</rdf:RDF>
