Windows PowerShell
The space to share experiences, engage and learn from experts.
5,458 Members

Windows PowerShell Spaces

Latest Activity

  • , 10-09-2016

    Just before the "Windows PowerShell" section became available I posted some information that me be on interest under "Windows Server PowerShell" section. Go ahead and check it out at:

     

    https://techcommunity.microsoft.com/t5/Windows-Server-PowerShell/PowerShell-Open-Source-and-Editor-of-Choice/m-p/15287#M13

    ... Read More
    118 Views
    4 Replies
    , 03-21-2017
    I am loving vscode these days, the powershell extension update has made it my editor of choice.
  • , 03-17-2017

    We just featured a career profile of MVP @Jaap Brasser who focuses on Powershell, Active Directory, SQL Server, Windows Server and many other technologies.  If you're interested on his take on what a successful career in the cloud looks like, read the pos

    ... Read More
    36 Views
    0 Reply
  • , 02-01-2017

    Looking for a way to update the features for our E3 licensed users. Setting them initially is no problem but we have not found a way to update someone that already has an E3.

     

    So user A has an E3 but only  the "SharePoint Online" feature on and we need 5 o

    ... Read More
    190 Views
    3 Replies
    , 02-18-2017

    I'm not sure if you managed to solve this, but I wrote a couple powershell functions that might help. I wasn't having a good time trying to re-assign licenses to users as we don't enable all features of a license. I found it easier to just remove all the licenses and re-assign them. that way I knew exactly which licenses they had. 

     

    The first is a function to clear the license for the user and the second function clears the licenses and then assigns the specific licenses, with the options that we chose. I hope it helps!

     

    # Removes all O365 Licenses
    # Accepts UPN
    # Returns Nothing
    function Remove-O365Licenses ($upn)
    {
    # Get user info from O365
    $userInfo = Get-MsolUser -UserPrincipalName $upn

    # Clear any existing licenses
    if ($userInfo.isLicensed -eq $true)
    {
    foreach ($sku in ($userInfo | select -ExpandProperty licenses))
    {
    #Write-Host "Removing License: " $sku.AccountSkuId
    Set-MsolUserLicense -UserPrincipalName $upn -RemoveLicenses $sku.AccountSkuId
    }
    }
    }

     

    # Clears previous license and sets correct Office 365 Staff license
    # Accepts UPN
    # Returns nothing
    function Set-O365StaffLicense ($upn)
    {
    # Set SKU options for staff
    $O365SkuStaff1 = New-MSOLLicenseOptions -AccountSkuID "lethsd51:PROJECTONLINE_PLAN_1_FACULTY" -DisabledPlans SHAREPOINTWAC_EDU
    $O365SkuStaff2 = New-MSOLLicenseOptions -AccountSkuID "lethsd51:STANDARDWOFFPACK_FACULTY" -DisabledPlans EXCHANGE_S_STANDARD,SHAREPOINTSTANDARD_EDU
    $O365SkuStaff3 = New-MSOLLicenseOptions -AccountSkuID "lethsd51:OFFICESUBSCRIPTION_FACULTY" -DisabledPlans SWAY,SHAREPOINTWAC_EDU

    # Get user info from O365
    $userInfo = Get-MsolUser -UserPrincipalName $upn

    Write-Host "Processing $upn"
    # Set usage location
    if ($userInfo.UsageLocation -eq $null)
    {
    Set-MsolUser -UserPrincipalName $upn -UsageLocation CA
    }

    # Remove All Current Licenses
    Remove-O365Licenses ($upn)

    # Apply licenses. The order of these matter!
    Write-Host "Setting License: Project Online for Faculty"
    Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses lethsd51:PROJECTONLINE_PLAN_1_FACULTY -LicenseOptions $O365SkuStaff1
    Write-Host "Setting License: Office 365 Education for Faculty"
    Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses lethsd51:STANDARDWOFFPACK_FACULTY -LicenseOptions $O365SkuStaff2
    Write-Host "Setting License: Office 365 ProPlus for Faculty"
    Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses lethsd51:OFFICESUBSCRIPTION_FACULTY -LicenseOptions $O365SkuStaff3
    Write-Host "Setting License: Exchange Online Plan 2 for Faculty"
    Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses lethsd51:EXCHANGEENTERPRISE_FACULTY
    }

     

     

     

  • , 02-06-2017

    I have a litte problem. I'm migrating OneDrives between Office 365 tenants. In the receiving end they require that all documents have a major version. In the orginating end there are a few users that have turned on Minor versions i the versioning settings

    ... Read More
    77 Views
    2 Replies
    , 02-07-2017

    Thanks.

    Here is my final function:

    Function Checkin-Allfiles {
        <#   
                .SYNOPSIS
                This function checks performs a CheckOut/CheckIn on files in order to elevate the files to Major Version.
        
                .DESCRIPTION
                This function checks performs a CheckOut/CheckIn on files in order to elevate the files to Major Version.
                It requires the Office Dev PnP module SharePointPnPPowerShellOnline to be loaded at runtime. 
    
                .PARAMETER LibraryUrl
                Specifies url of the site collection
    
                .PARAMETER Folder
                Specifies the Root Folder to check in files from
    
                .EXAMPLE
                Checkin-Allfiles -LibraryUrl https://contoso.sharepoint.com -Folder Documents 
                This gets all files in the documents folder and all subfolders, and checks in a new major version of all files 
    
                .EXAMPLE
                Checkin-Allfiles -LibraryUrl https://contoso.sharepoint.com -Folder Documents/subfolder 
                This This gets all files in the Subfolder folder and all subfolders, and checks in a new major version of all files 
    
    
    
        #>
        [cmdletbinding()]
    
        param (
            [Parameter (position = 0,HelpMessage = 'The Document Library URL', Mandatory = $TRUE)]
            [String]$LibraryUrl,
            [Parameter (position = 1,HelpMessage = 'The Folder Site Relative URL (Documents)', Mandatory = $TRUE)]
            [String]$Folder
        )
        Write-Verbose -Message "Connecting to $LibraryUrl"
        Connect-PnPOnline -Credentials (get-credential) -url $LibraryUrl
        Write-Verbose -Message "Getting the files in $Folder" 
        $files = Find-PnPFile -Folder $Folder -Match * -Verbose
        Write-Verbose -Message 'Done getting files'
        foreach ($file in $files) {
            Write-Verbose -Message "Checking out $($file.ServerRelativeUrl)"
            Set-PnPFileCheckedOut -Url $file.ServerRelativeUrl 
            Write-Verbose -Message "Checking in $($file.ServerRelativeUrl)"
            Set-PnPFileCheckedIn -Url $file.ServerRelativeUrl -CheckinType MajorCheckIn -Comment 'Checked In with Script to raise version to major' 
        }
    
    }
  • , 11-21-2016

    If you search for "PowerShell Cheat Sheet" in Duck Duck Go, you get a really great reference for all sorts of syntax/operators/if/loops/etc.

     

    https://duckduckgo.com/?q=powershell+cheat+sheet&ia=cheatsheet&iax=1

     

    Read More
    86 Views
    1 Reply
    , 01-30-2017
    Nice!
Windows PowerShell Announcements
Announcements
Welcome to the Windows PowerShell Community! This is the place discuss best practices, news, and the latest trends and topics related to Windows PowerShell. Third party promotional content will be deleted. Thanks for your help keeping this community a vibrant and useful place!

 

Join us for an online event to celebrate the global availability of Microsoft Teams

On Tuesday, March 14 at 8:30 a.m. PT, we will celebrate the global availability of Microsoft Teams—the chat-based workspace in Office 365. Please join us for an online event to mark the occasion. Microsoft Corporate Vice President Kirk Koenigsbauer and a special guest will share perspectives on teamwork, what’s new in Microsoft Teams, and talk about how customers are using Office 365 to collaborate and deliver great results.

Register now

 

Top Contributors
User Likes Count
1