Tag: powershell

  • Pre-Provision a user’s OneDrive in Microsoft 365 using PowerShell

    Pre-Provision a user’s OneDrive in Microsoft 365 using PowerShell

    When a new account is created in Microsoft 365, its OneDrive is not provisioned, which the user must do. If you needed to pre-provision it for the user, you would need to log in with every user or use the below method to pre-provision it using PowerShell. Usually, this is done to pre-fill the OneDrive of a user with startup data and folder structure as well as it is needed to be provisioned for a migration process.

    A requirement for this is to have the SharePoint Online Management Shell installed, which can be downloaded from the Microsoft site https://www.microsoft.com/en-US/download/details.aspx?id=35588&msockid=3765afd8b0d06ff03ce2baf8b1a76eb2.

    Once downloaded and installed, open a PowerShell window.

    Type the following command

    Connect-SPOService -Url <your admin sharepoint URL>

    The admin SharePoint URL is usually the domain -admin.sharepoint.com for example https://mydomain-admin.sharepoint.com

    Then you will need the following command to pre-provision the Onedrive.

    Request-SPOPersonalSite -UserEmails <email address of user>

    This will provision the OneDrive or the user.

  • Install Module with PowerShell: NuGet Unable to download, check your internet connection

    Install Module with PowerShell: NuGet Unable to download, check your internet connection

    While installing the NuGet PowerShell module, you will get the following error

    WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
    WARNING: Unable to download the list of available providers. Check your internet connection.
    WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
    Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
    At line:1 char:1
    + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider

    To resolve the problem open a PowerShell window as Administrator and enter the following command.
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

    This will resolve the problem temporarily as if you would run the command again, it will still prompt the same problem. To resolve the issue permanently, you need to update the registry by running the below command to update the registry.

    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

    Close all PowerShell windows and try again with the following command to confirm that the protocol has been updated.

    [Net.ServicePointManager]::SecurityProtocol