Giter Club home page Giter Club logo

windows365-psscripts's Introduction

Windows 365 sample script

This project contains Windows 365 related remediation or enhancement scripts to provide IT Admin better experience while managing CloudPC.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

windows365-psscripts's People

Contributors

ashleyyangsz avatar davefalkus avatar donnaryanmicrosoft avatar emma0727 avatar eugene2candy avatar jastoker avatar microsoft-github-operations[bot] avatar microsoftopensource avatar suyliums avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windows365-psscripts's Issues

remove multiple signinlog queries

Thanks for this code, it really helped me know where to look for this data.

I found that the signinlog query that get's repeated for each CloudPC user can be moved outside the loop with this command:

$logons = Get-MgAuditLogSignIn -Filter "startswith(devicedetail/displayname, 'CPC-') and appdisplayname eq 'Windows Sign In' and createdDateTime gt $string"

This allows the removal of the 2 second sleep, so the script completes much more quickly.

Also, I believe that -all should be added to the CloudPC query in case the number grows beyond 100.
$cloudPCs = Get-MgDeviceManagementVirtualEndpointCloudPC -all

Thanks again,
Martin

webrtc compare fails

The compare for the webrtc version is not on a integer or version number, so it failed to detect correctly if it needed to be updated or not.

I changed line 107 and 110 to below so it will compare correctly on version number, for the if statement to determine upgrading is needed it or no.
[version]$RTCCurrent = $Global:currentversion (L:107)

#Calls the function to get the installed version number
[version]$RTCInstalled = get-installedRTCver -Erroraction SilentlyContinue L:110)

Remove AzureADPreview dependency Windows 365 Cloud PC Usage Report

First thanks for time and effort spent for providing these scripts.
I am to time constraint to do a PR for this so I hope it is ok, to share it via this post.

I am not able to share my script as I use DevOPS so removed 85% of the code for the [Windows 365 Cloud PC Usage Report] script.

Some things that I encountered or changed.
The current version check for the mggraph version does not work, as it does a compare on a string value for version(not on a integer), so this has no added benefit.
I would suggest to remove this or rewrite it so it does upgrade or ask for a upgrade, no added benefit with the current check as the scripts continues to work.

The second is I do not like to be using the AzureADpreview module, so I replaced the line:
$Logons = Get-AzureADAuditSignInLogs -Filter "startswith(userPrincipalName,'$($CloudPCUser.UserPrincipalName)') and appdisplayname eq 'Windows Sign In' and createdDateTime gt $string"

With:
$Logons = Get-MgAuditLogSignIn -Filter "startsWith(userPrincipalName,'$($CloudPCUser.UserPrincipalName)') and appdisplayname eq 'Windows Sign In' and createdDateTime gt $string"

And removed all lines of code that were needed for the AzureADpreview connection.
This way it 100% uses the mggraph modules.

The code below does not work as the variable $total is never set $count should be used.

Line 255
if ($total -eq 0) { write-host "User has not logged in." -ForegroundColor Red }

I rewrote that to this so it also writes an entry that no logons were found in the past $offset days.

    #Counts each web logon
    foreach ($Logon in $Logons) {

        if (($Logon.UserPrincipalName -eq $CloudPCUser.UserPrincipalName) -and ($Logon.DeviceDetail.Displayname -like "CPC-*") -and ($Logon.DeviceDetail.DeviceID -eq $CloudPCUser.AadDeviceId)) {
            $count = $count + 1

            if ($logon.CreatedDateTime -gt $LastLogon) { $LastLogon = $Logon.CreatedDateTime }    
             #outputs local client logon count
    write-host "Logon count is $count"
    $output.Logons = $count

    #outputs the last logon time
    write-host "User's last logon time is(UTC)"$LastLogon
    $output.LastLogon = $LastLogon
        }
    }
    #outputs notification if no logon activity has been recorded
    if ($count -eq $null) {
        
        $count = 0
        write-host "No logons found in past $offset days."
        $output.Logons = $count
        $output.LastLogon = "No logons found in past $offset days."
    }

Microsoft.Graph update has broken Microsoft.graph Authentication in the script.

It appears that this script has broken since Microsoft made changes to the Microsoft.Graph PowerShell authentication mechanism.

Select-MgProfile : The term 'Select-MgProfile' is not recognized as the name of a cmdlet...

Is there an easy fix to this?

Setting profile as beta...
WARNING: Unable to find type [Microsoft.Graph.PowerShell.Authentication.Utilities.DependencyAssemblyResolver].
Select-MgProfile : The term 'Select-MgProfile' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\library\PowerShell\W365_User_Logon_Report.ps1:132 char:5

  • Select-MgProfile -Name beta
    
  • ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Select-MgProfile:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Latest version of AzureADPreview module is 2.0.2.183
Current installed version of AzureADPreview module is 2.0.2.183
The installed AzureADPreview module is up to date.
Not connected to Azure AD. Connecting...
Connected to Azure AD
Tenant ID is xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Get-MgDeviceManagementVirtualEndpointCloudPC : One or more errors occurred.
At C:\library\PowerShell\W365_User_Logon_Report.ps1:200 char:1

  • $cloudPCs = Get-MgDeviceManagementVirtualEndpointCloudPC
  •   + CategoryInfo          : NotSpecified: (:) [Get-MgDeviceMan...intCloudPC_List], AggregateException
      + FullyQualifiedErrorId : System.AggregateException,Microsoft.Graph.PowerShell.Cmdlets.GetMgDeviceManagementVirtualEndpoi
     ntCloudPC_List
    
    

PS C:\library\PowerShell>

Teams Reinstall - Per User Fix - QUSER Remediation Error...

Thanks to the team creating these scripts, they will be a life saver if I can get them to work properly.

I'm using the Teams Reinstall - Per User Fix and am getting the following remediation error:

quser : The term 'quser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Windows\IMECache\HealthScripts\9bc64704-2ac2-4894-a0bd-2ed264464d77_1\remediate.ps1:54 char:8 + (((quser) -replace '^>', '') -replace '\s{2,}', ',').Trim() | For ... + ~~~~~ + CategoryInfo : ObjectNotFound: (quser:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

I'm interpreting the instructions as needing to run this script as "Run this script using the logged-on credentials" but I've tried not running as this as well, same error. I'm not sure if this is normal or if I'm doing something wrong.

My settings I'm using are:

image

Thanks in advance!
Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.