Sylver SCHORGEN Blog's

Articles, astuces et news sur les technologies Microsoft et plus particulièrement tournant autour de Powershell
    • 7/10/2018

    [POWERSHELL TIPS] How to create an Exchange Online Distribution Group

    Hello,

    Here is a little PowerShell tip on how to create an Exchange Online Distribution Group with PowerShell. The cmdlet I will use is New-DistributionGroup with the following parameters : 

    • Name : Unique value used for the name of the group. The maximum length is 64 characters. This value will be used as well if you don't use the DisplayName parameter
    • Alias : Parameter used to specify the Exchange alias for the recipient. If you create a distribution group without specifying the primary email address, the alias will be used (<alias> @ <domain>). If you don't specify this parameter, the value of the Name parameter will be used (without the spaces and unsupported characters)
    • ManagedBy : Parameter used to specify the group owner. If you don't specify a user account here, the user account creating the group (via PowerShell) will be used
    • MemberDepartRestriction : Parameter used to specify the restrictions on users requests to leave the distribution group. There are 2 values possible :
      • Open : The members can leave the distribution group when they want to without any approval
      • Closed : The members can't remove themselves from the distribution group and the requests are automatically rejected. The membership is managed by the group owner(s)
    • MemberJoinRestriction : Parameter used to specify the restriction on users requests to join the distribution group. There are 3 values possible :
      • OpenThe members can add themselves to the distribution group when they want to without any approval
      • ClosedThe members can't add themselves to the distribution group and the requests are automatically rejected. The membership is managed by the group owner(s)
      • ApprovalRequiredThe members can request to join the distribution group. The request is submitted for approval to the group owner(s). The user will only be in the distribution group after approval
    • Members : Parameter used to specify the recipients that are members of the distribution group. You must use a value that uniquely identifies the recipient like the Name, DisplayName, Alias, DN, Canonical DN, Email address or GUID. If you wan to specify multiple members, separate them with a coma (user1, user2, user3)
    • PrimarySMTPAddress : Parameter used to specify the primary email address of your distribution group
    • RequireSenderAuthenticationEnabled : Parameter used to specify if you want to accept only messages from your organization (internal) or from anyone (internal and external).

    The PowerShell syntax I use to create a distribution group with MemberDepartRestriction set to ClosedMemberJoinRestriction set to Closed and RequireSenderAuthenticationEnabled set to $false

    New-DistributionGroup -Name "Demo Sylver" -Alias "DemoSylver" -ManagedBy "Sylver" -MemberDepartRestriction "Closed" -MemberJoinRestriction "Closed" -Members "John","Paul" -PrimarySmtpAddress "demosylver@mydomain.com" -RequireSenderAuthenticationEnabled $false

     
    • 8/9/2018

    [POWERSHELL] Modify your Office 365 Groups language and configuration

    Hello everyone,

    I recently needed to convert every Public Group of an Office 365 tenant to the french language and to automatically Subscribe new members and Let people outside the organization send email to the group.

    There were approximately 100 groups so I didn't want to do it manually ;) (even if there had been 1 group, I would have done it with PowerShell).

    Here is the line I used to configure those 100 groups with these parameters : 

    Get-UnifiedGroup | Where-Object {$_.AccessType -eq 'Public'} | Set-UnifiedGroup -Language "fr-FR" -AutoSubscribeNewMembers -RequireSenderAuthenticationEnabled $false

    And yes, it works on PowerShell and PowerShell Core -> So on Windows, Linux and Mac OS :D

    • 17/8/2018

    [POWERSHELL] Configure Exchange Online email forwarding

    Hi everyone,

    I've created a PowerShell script to add an email forwarding rule on a mailbox for Exchange Online. What this script does is :

    • Connect to Exchange Online : You will be prompt for an admin credentials
    • Verifying that the source email address does not already have a forwarding rule
    • If your source email address does not have a forwarding rule, the script creates the one your want to configure
    • By default, the script keeps a copy of every email in the source mailbox and forward the email. If you don't want to keep a copy in the source mailbox, you can add the parameter -KeepACopyAndForward with the value $false

    I've added some verbose log in order to know what the script is doing :)

    How to use the script :

    .\New-O365EmailForwardingRule.ps1 -sourceEmailAddress "john.doe@mail.com" -DestinationEmailAddress "jean.dupont@mail.com"
    .\New-O365EmailForwardingRule.ps1 -sourceEmailAddress "john.doe@mail.com" -DestinationEmailAddress "jean.dupont@mail.com"
    -KeepACopyAndForward $false

    The Link of my script : https://github.com/sschorgen/PowerShell/blob/master/O365_New-O365EmailForwardingRule/New-O365EmailForwardingRule.ps1 

    • 16/8/2018

    [POWERSHELL] Add a Mail Contact in Exchange Online

    Hi everyone,

    I've created a PowerShell script to add a Mail Contact in an Exchange Online. What this script does is :

    • Connect to Exchange Online : You will be prompt for an admin credentials
    • Verifying that the contact does not already exist
    • If your contact does not exist, the script creates it
    • If you added the parameter to hide your contact from the GAL, the script hides it

    I've added some verbose log in order to know what the script is doing :)

    How to use the script :

    .\New-O365MailContact.ps1 -ContactEmailAddress "john.doe@mail.com" -UserFullName "John DOE"
    .\New-O365MailContact.ps1 -ContactEmailAddress "john.doe@mail.com" -UserFullName "John DOE"
    -HideFromGAL $True

    The Link of my script : https://github.com/sschorgen/PowerShell/blob/master/O365_New-O365MailContact/New-O365MailContact.ps1

    • 15/8/2018

    [POWERSHELL] Add a user to a distribution group

    Hello everybody,

    I created a script to add a user in an Exchange Online distribution group. What this script does is :

    • Connect to Exchange Online : You will be prompt for an admin credentials
    • Verifying that your user is not in the distribution group
    • If your user is not in the DG, he or she will be added to the DG

    I've added some verbose log in order to know what the script is doing :)

    How to use the script :

    Add-UserToO365DistributionGroup.ps1 -DistributionGoupName "Marketing Team" -Member "john.doe@mail.com"

    The Link of my script : https://github.com/sschorgen/PowerShell/blob/master/O365_Add-UserToO365DistributionGoup/Add-UserToO365DistributionGoup.ps1

    • 3/8/2018

    [POWERSHELL] DSC Resource Kit Release July 2018

    Hi everyone,

    Microsoft released the July update of the DSC Resource Kit. 12 modules have been updated :

    • ComputerManagementDsc
    • SecurityPolicyDsc
    • SharePointDsc
    • SqlServerDsc
    • xActiveDirectory
    • xDhcpServer
    • xDscResourceDesigner
    • xExchange
    • xPowerShellExecutionPolicy (now deprecated since now in ComputerManagementDsc)
    • xPSDesiredStateConfiguration
    • xRemoteDesktopSessionHost
    • xWebAdministration



    For more details => https://blogs.msdn.microsoft.com/powershell/2018/07/25/dsc-resource-kit-release-july-2018/

    • 2/8/2018

    [POWERSHELL] Let's automate my computer configuration :)

    Hello,

    In my obsession about automation, I never took the time to automate my own laptop reconfiguration (yeah I know, poor me ...). I have my up to date Windows 10 image with my drivers, but that's all. I never automated my software reinstallation or my Windows 10 configuration as I like it :)

    So the last couple of days, I've decided to do so :)

    You'll find in my GitHub repo a script doing these steps :

    1. Check if chocolatey is installed, if not, install it
    2. Install some softwares
      • Foxit Reader
      • Flash Player
      • Google Chrome
      • Firefox
      • VLC
      • Silverlight
      • Handbrake
      • Sonos Controller
      • iTunes
      • qBittorent
      • Git
      • GitHub
      • Visual Studio Code
      • Kitty
      • Remote Desktop Manager
      • FileZilla
      • Teamviewer
      • Keepass
      • Winscp
      • WinMerge
      • 7zip
      • Lightshot
      • Evernote
      • Dropbox
      • Microsoft Office 365 Pro Plus
      • Microsoft Teams
      • Slack
      • Rufus
      • Grisbi
      • Toggl
      • Listary
      • JRE 8
      • NuGet
      • AzureAD PowerShell module
      • MSOnline PowerShell module
      • SharePoint PnP for SharePoint Online module
    3. Configuring Windows as I want it to be configured
      • Install Hyper-V
      • Disable Windows 10 hibernation
      • Unpin start menu tiles
      • Remove Windows 10 Fax
      • Uninstall Windows XPS printer
      • Uninstall Microsoft Windows 10 preinstalled softwares
      • Show "This PC" desktop shortcut
      • Show hidden files in Windows explorer
      • Show well known extension in Windows explorer
      • Hide search taskbar
      • Configure Windows explorer to open at "This PC" location
      • Configure Control Panel view to "Categories"
      • Hide frequently and recently used item from Windows explorer

    For the configuration functions, I used some functions developped by Ali Robertson in its script reclaimWindows10.ps1

    You'll find my script on my GitHub repository : Direct Link to the script

    • 31/7/2018

    [SHAREPOINT 2013 - SP DESIGNER] Error were found when compiling the workflow. The workflow files were saved but cannot be run

    Hello everyone,

    Yesterday I was helping a customer on the creation of a particular workflow and when we published it we had this error : Error were found when compiling the workflow. The workflow files were saved but cannot be run.

    The detailed message on SharePoint ULS was :

    Microsoft.Workflow.Client.WorkflowCommunicationException: The request was aborted: The request was canceled. Client ActivityId : 7a290e9c-0917-7088-afc4-e65fd25c5c0b. ---> System.Net.WebException: The request was aborted: The request was canceled. ---> System.ServiceModel.ServiceActivationException: The requested service, 'net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc' could not be activated. See the server's diagnostic trace logs for more information

    After searching on the web and trying some well documented solutions, I finally found what was the cause of our issue. The service Net.Pipe Listener Adapter wasn't started on the SharePoint web server. After I started it, I was able to publish the workflow.

    • 25/7/2018

    [SHAREPOINT] SharePoint 2019 Public Preview is now Generally Available

    Hello everyone,

    You have to clear your schedule for this week-end, SharePoint 2019 Public Preview is GA ! This mean we have to install it, test it and be prepare for future implementations.

    There a lot of new features including :

    • Modern User Experiences
    • Modern Team Sites
    • Modern Lists
    • Modern Site Pages
    • Communication Sites
    • PowerApps and Flow integration (I loooove this one !!!)
    • SMTP Server authentication
    • SharePoint Hybrid made easy
    • Etc ...

    You can download this new version of SharePoint right here : https://www.microsoft.com/en-us/download/details.aspx?id=57169

    Some guides provided by Microsoft :

    For more details (the original article by Microsoft) : https://blogs.technet.microsoft.com/christianheim/2018/07/24/sharepoint-2019-public-preview-generally-available/

    • 2/5/2018

    [POWERSHELL] DSC Resource Kit Release May 2018

    Hi everyone,

    Microsoft just released an update of the DSC Resource Kit. 12 modules have been updated :

        ActiveDirectoryCSDsc (previously xAdcsDeployment)
        CertificateDsc (previously xCertificate)
        ComputerManagementDsc (previously xComputerManagement)
        DFSDsc (previously xDFS)
        SqlServerDsc
        xDnsServer
        xDscResourceDesigner
        xExchange
        xNetworking
        xPendingReboot
        xSMBShare
        xWebAdministration

    For more details => https://blogs.msdn.microsoft.com/powershell/2018/05/02/dsc-resource-kit-release-may-2018/

    • 2/5/2018

    [POWERSHELL] Release du ressource kit DSC de mai 2018

    Hello tout le monde,

    Microsoft a sorti son ressource kit DSC de mai 2018. Les mises à jour apportées touchent 12 modules :

    • ActiveDirectoryCSDsc (previously xAdcsDeployment)
    • CertificateDsc (previously xCertificate)
    • ComputerManagementDsc (previously xComputerManagement)
    • DFSDsc (previously xDFS)
    • SqlServerDsc
    • xDnsServer
    • xDscResourceDesigner
    • xExchange
    • xNetworking
    • xPendingReboot
    • xSMBShare
    • xWebAdministration

    Pour plus de détail => https://blogs.msdn.microsoft.com/powershell/2018/05/02/dsc-resource-kit-release-may-2018/

    • 7/4/2018

    [OFFICE 365] Office 365 Attack Simulator

    Hello,

    Microsoft launched a new feature in Office 365 called Office 365 Attack Simulator. According to Microsoft, "you can run realistic attack scenarios in your organization. This can help you identify and find vulnerable users before a real attack impacts your bottom line". This feature can help your security team to do Phishing attack, Password-spray attack and Brute-force password attack. This feature is available in Office 365 E5 plans.

    If you want more details, I invite you to read these articles :

    • 6/4/2018

    Présentation des outils collaboratifs de la suite Office 365 aux BTS Assistants Manager

    J'ai eu l'honneur de présenter, durant une session de 2h, les outils collaboratifs de la suite Office 365 aux BTS Assistants Manager du Lycée Lapérouse.

    Je tenais à remercier les professeurs de m'avoir donner l'opportunité de réaliser cette session devant 25 élèves déjà bien au fait de la collaboration (génération Z hey hey ;))

    Durant cette présentation, nous avons pu discuter des éléments suivants :

    • Les enjeux du collaboratif en entreprise
    • La frontière social / collaboratif
    • La mobilité
    • Les outils collaboratifs d'Office 365 (Skype, Yammer, SharePoint, Teams, ...)

    Pour ceux qui souhaite accéder à cette présentation, c'est par ici : https://www.slideshare.net/SylverSCHORGEN/la-collaboration-en-entreprise

    • 6/4/2018

    Petit Déjeuner numérique MEDEF NC - La GED et la collaboration avec SharePoint et Office 365

    Dans le cadre des Petit-déjeuners du MEDEF-NC, en collaboration avec Julien CHABLE (MVP SharePoint / Office 365), nous avons eu l’occasion de présenter aux entreprises locales les fonctionnalités de SharePoint/O365 dans le domaine de la gestion de contenu et de la GED.

    Les entreprises font actuellement face à la transistion digitale et se doivent d'être les plus compétitves possibles, tant sur le plan local que sur le plan international pour certaine. Les enjeux de la collaboration et la gestion electronique des documents n'ont jamais été aussi importants.

    S'orienter vers du “sans-papier” est aussi un point important tant sur le plan économique qu'écologique.

    Pour ceux qui souhaite consulter la présentation, c'est par ici : https://www.slideshare.net/SylverSCHORGEN/la-ged-et-le-collaboratif-avec-office-365

    • 5/4/2018

    Thank you Microsoft for the MVP Award !

    I received a very nice email on April 2, 2018 (New Caledonia timezone) from Microsoft telling me that I was awarded as a Microsoft Most Valuable Professional (MVP).

    According to Microsoft, "Microsoft MVPs are a select group of experts who represent technology’s best and brightest, and share a deep commitment to their communities". I'm very honored to be awarded as an MVP by Microsoft ! Thank you Microsoft !

    I would like to thanks Martine Tiphaine (MVP Community Program Manager for New Caledonia) for the help with my application. I also would like to thanks Julien CHABLE for recommanded my name to the MVP Award Review Comitee, animating the MS Afterworks in New Caledonia with me and all his support ;).

    Finally, I would like to thank my family, friends, colleagues and employer for supporting me and challenging me in everything I'm doing !

    Thanks again everyone !

    • 23/3/2018

    [POWERSHELL] Release du ressource kit DSC de mars 2018

    Hello tout le monde,

    Microsoft a sorti sont ressource kit DSC de mars 2018. Les mises à jour apportées touchent 7 modules (SharePointDsc, SqlServerDsc, xActiveDirectory, xComputerManagement, xFailOverCluster, xNetworking, xPSDesiredStateConfiguration). 37 problèmes ont été corrigés avec cette release.

    Pour plus de détail sur ces updates -> https://blogs.msdn.microsoft.com/powershell/2018/03/21/dsc-resource-kit-release-march-2018/ 

    • 23/3/2018

    [WINDOWS SERVER] Preview de Windows Server 2019

    Bonjour tout le monde,

    Microsoft a annoncé il y a quelques jours, la disponibilité de Windows Server 2019 en Preview.

    Les orientations de cette nouvelle mouture :

    • Les infrastructures hyperconvergées
    • Les plateformes applicatives
    • Les scenarios hybrides
    • La sécurité

    Pour plus de détail sur chacun de ces éléments, l'article officiel -> https://cloudblogs.microsoft.com/windowsserver/2018/03/20/introducing-windows-server-2019-now-available-in-preview/

    Si vous voulez téléchargement cette Preview : https://insider.windows.com/en-us/for-business-getting-started-server/

    • 5/3/2018

    [POWERSHELL] Installer les outils PowerShell pour Office 365 en PowerShell DSC

    Bonjour tout le monde,

    J'ai tendance à utiliser et pousser du DSC partout où je le peux ^_^

    Pour l'installation des outils PowerShell pour Office 365, j'ai également créé mon petit script DSC pour cela. Le seul élément que j'installe "manuellement" est le module Azure ActiveDirectory (MSOnline) en tapant la commande : Install-Module MSOnline.

    Pour le reste, voici le script DSC que j'utilise (il faut au préalable télécharger msoidcli64.msiSharePointOnlineManagementShell.msi et SkypeOnlinePowerShell.exe et les mettre dans le dossier C:\Sources\Office365 dans le cas de notre script) :

    Configuration InstallO365Tools
    {
    Node "swi-adfs16-qul.intranet.opt"
    {
    Package MsoidPS
    {
    Ensure = "Present"
    Name = "Microsoft Online Services Sign-in Assistant"
    Path = "C:\Sources\Office365\msoidcli_64.msi"
    ProductId = 'D8AB93B0-6FBF-44A0-971F-C0669B5AE6DD'
    }
    Package SPOPS
    {
    Ensure = "Present"
    Name = "SharePoint Online Management Shell"
    Path = "C:\Sources\Office365\SharePointOnlineManagementShell_7317-1200_x64_en-us.msi"
    ProductId = '95160000-115B-0409-1000-0000000FF1CE'
    DependsOn = "[Package]MsoidPS"
    }
    Package SkypeForBusinessPS
    {
    Ensure = "Present"
    Name = "Skype Online Management Shell"
    Path = "C:\Sources\Office365\SkypeOnlinePowershell.exe"
    ProductId = ''
    Arguments = '/s'
    DependsOn = "[Package]SPOPS"
    }
    }
    }

    #InstallO365Tools -OutputPath "C:\Sources\DSC\InstallO365Tools"
    #Start-DscConfiguration -Path "C:\Sources\DSC\InstallO365Tools" -wait -verbose -Force
    • 5/3/2018

    [POWERSHELL] Installer PowerCLI Core 1.10.0

    Hello tout le monde,

    Vous l'avez surement vu dans les news récentes, VmWare a publié PowerCLI Core pour PowerShell Core 6. Le gros avantage de cette version est qu'il est possible de l'installer sur Linux, MacOS et Windows :-)

    L'installation est extrêmement simple :

    1. Lancez PowerShell Core
    2. Tapez la commande Install-Module -Name VMware.PowerCLI -Scope CurrentUser
    3. Attendez que l'installation se termine ;)

    Une fois l'installation terminée, vous pouvez lister les modules disponibles pour vous assurez que l'installation s'est corectement terminée : Get-Module -Name "*VmWare*" -ListAvailable

    Il ne vous reste plus qu'à développer vos scripts, depuis n'importe quel plateforme :-)

    • 3/2/2018

    [POWERSHELL] Se connecter à Exchange Online

    Voici les 3 lignes de PowerShell nécessaires pour se connecter à Exchange Online :

    $Credentials = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    La première ligne de PowerShell vous promptera pour entrer le login / mot de passe d'un compte administrateur Office 365.
    • 3/2/2018

    [POWERSHELL] Connect to Exchange Online

    You'll find bellow the 3 PowerShell lines necessary to connect to Exchange Online :

    $Credentials = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    The first line will result by prompting you for an Office 365 login and password.
    • 2/2/2018

    [POWERSHELL] Compter le nombre de mails reçus par un domaine spécifique

    Bonjour tout le monde,

    Ces derniers temps, je développe pas mal de script de statistiques pour des clients ou pour de l'interne. Récemment, j'ai eu besoin de créer un script qui permettait, en autre, de compter le nombre de mails reçus par un domaine spécifique. Ceci me permet de connaître le nombre de mails reçus durant les 7 derniers jours en provenance d'un domaine spécifique.

    Commençons par la commande PowerShell permettant de récupérer la liste des mails envoyés par un domaine spécifique durant les 7 derniers jours :  

    Get-MessageTrace -StartDate (Get-Date).Adddays(-7) -EndDate (Get-Date) -SenderAddress *@domaine.com

    Cette commande dispose de plusieurs paramètres :

    • -StartDate (Get-Date).AddDays(-7) : Permet d'indiquer que la date de début correspond à celle d'il y a 7 jours
    • -EndDate (Get-Date) : Permet d'indiquer que la date de fin correspond à aujourd'hui
    • -SenderAddress *@domaine.com : Permet d'indiquer que nous cherchons tous les mails en provenance du domaine domaine.com

    Une fois que nous avons ce résultat, il ne nous reste plus qu'à utiliser la propriété .Count de l'objet retourné pour connaître le nombre de mails total. La commande finale est donc celle-ci : (Get-MessageTrace -StartDate (Get-Date).Adddays(-7) -EndDate (Get-Date) -SenderAddress *@domaine.com).Count

    On constatera ici que le domaine @domaine.com nous a envoyé 1 000 mails.

    • 25/1/2018

    [POWERSHELL] Ajouter une machine distante dans le TrustedHost

    Hello tout le monde,

    En ce moment je fais pas mal d'Azure et une chose que je fais à chaque nouvelle VM de créée, c'est d'ajouter l'IP de la VM dans mon TrustedHost. En effet, n'étant pas dans le même domaine, c'est une obligation.

    Voici la commande PowerShell qu'il est indispensable de taper : Set-Item WSMAN:\localhost\Clients\TrustedHost -Value votre_ip

    Il faut avoir, bien entendu, lancer votre console PowerShell en tant qu'administrateur. Suite à cela, vous pourrez effectuer du PSRemoting sur cette machine. Cela fonctionne également avec les IP publiques (comme pour Azure ;))

    • 25/1/2018

    [POWERSHELL] Add a remote machine to your TrustedHost

    Hi everyone,

    I'm doing a lot a Azure IAAS those days and one thing I need to do for each VM I create on Azure is to add the public IP to my TrustedHost in order to do some PSRemoting (because these servers are not in my domain).

    Here is the command you need to enter on your computer to add an IP to your TrustedHost : Set-Item WSMAN:\localhost\Clients\TrustedHost -Value votre_ip

    Your PowerShel console must be launched as an Administrator.

    • 24/1/2018

    [POWERSHELL]Installer PowerShell Core 6.0 sur Mac OS

    Hello tout le monde,

    Afin de pouvoir installer et utiliser PowerShell sur Mac OS, commencez par télécharger le .pkg à cette adresse : https://github.com/PowerShell/PowerShell.

    Suite au téléchargement, installez PowerShell sur votre Mac.

    Après l'avoir installez, il ne vous reste plus qu'à lancer une console et de taper pwsh afin de lancer PowerShell.