ztrhgf / useful_powershell_modules Goto Github PK
View Code? Open in Web Editor NEWSource code for modules placed in PowerShell Gallery and on my https://doitpshway.com blog.
Home Page: https://doitpshway.com
Source code for modules placed in PowerShell Gallery and on my https://doitpshway.com blog.
Home Page: https://doitpshway.com
Nice module! The device policy features was especially useful.
Though I ran into issues running it with PS 7...
Well not your part of the module but connect-msgraph included in the intune module.
When I just run the cmdlet to interactively auth receive the following in PS7 but not 5. Haven't dug into it really to see if workstation or other cause but as the intune module sadly hasn't been updated in 4 years figured it might just be incompatible.
Connect-MSGraph: Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
last line of the code
Microsoft appear to have changed the Header names on the source page so the $table values containing the command maps are now headed differently.
So $."Azure AD cmdlets" should be $."Azure AD cmdlet" and $."Microsoft Graph PowerShell cmdlets" should be $."Microsoft Graph PowerShell cmdlet"
Hi when selecting a script, (any of them) for redeploy, I get this error output. Please advise, Id love to you your tools, they look impressive and really useful.
The keys are all there in the registry ?
Also is there a way to start the scrip and not have the result details column showing as default? Many Thanks
PS C:\Windows\system32> Invoke-IntuneScriptRedeploy -scriptType script -getdatafromintune
WARNING: Preparing redeploy for script cc832524-5bb8-4bdf-8d36-748c5926bc45 (scope xxxxxxxxxxxxxxxxxxxx.co.uk) by
deleting it's registry key
BUG??? Script cc832524-5bb8-4bdf-8d36-748c5926bc45 with scope xxxxxxxxxxxxxxxxxxxx.co.uk wasn't found in the
registry
At C:\Program Files\WindowsPowerShell\Modules\IntuneStuff\1.4.4\IntuneStuff.psm1:6509 char:25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi!
first off I wanted to thank for this useful module. I wanted also to report an issue with it when running the Get-IntuneReport cmdlet:
Import-Module : The specified module 'Variables' was not loaded because no valid module file was found in any module directory
It looks like it's loading a module which is not in the IntuneStuff module...
https://github.com/ztrhgf/useful_powershell_modules/blob/ecc93abe4de3dbf726de4d2393cf738eade6f0c1/IntuneStuff/IntuneStuff.psm1#LL7149C85-L7149C85
$appMatch = Select-String -Path $intuneLog -Pattern "[Win32App] ExecManager: processing targeted app .+ id='$appId'" -Context 0, 2
should be changed to
$appMatch = Select-String -Path $intuneLog -Pattern "[Win32App][V3Processor] Processing subgraph with app ids: $appId" -Context 0, 1
and
Greets,
RW
#the following does not work keeps returning
#Here is the terminal output
WARNING: Command's Invoke-MgGraphRequest definition is missing. Skip getting its dependencies
WARNING: Command's Invoke-MgGraphRequest definition is missing. Skip getting its dependencies
WARNING: Command's Invoke-MgGraphRequest definition is missing. Skip getting its dependencies
WARNING: Command's Invoke-MgGraphRequest definition is missing. Skip getting its dependencies
WARNING: Command's Invoke-MgGraphRequest definition is missing. Skip getting its dependencies
WARNING: Command's Get-MgApplication definition is missing. Skip getting its dependencies
WARNING: Command's Update-MgApplication definition is missing. Skip getting its dependencies
WARNING: Unable to find command 'Invoke-MSGraphRequest' (source: ) details. Skip getting its dependencies
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
WARNING: Unable to find command 'Remove-O365OrphanedMailbox' (source: ) details. Skip getting its dependencies
WARNING: 'Find-MgGraphCommand' was unable to find command ''?!
WARNING: Be noted that it is impossible to tell whether found permissions for some command are all required, or just some subset of them (for least-privileged access). Consult the Microsoft Graph Permissions Reference documentation to identify the least-privileged permission for your use case :(
Here is the code that I used:
# Ensure required modules are installed
Install-Module -Name MSGraphStuff -Scope Allusers -Force -AllowClobber
Install-Module -Name DependencySearch -Scope Allusers -Force -AllowClobber
Install-Module -Name Microsoft.Graph.Authentication -Scope Allusers -Force -AllowClobber
Install-Module -Name Microsoft.Graph.Reports -Scope Allusers -Force -AllowClobber
Install-Module -Name Microsoft.Graph.Users -Scope Allusers -Force -AllowClobber
Load the necessary modules
Import-Module MSGraphStuff Import-Module DependencySearch Import-Module Microsoft.Graph.Authentication Import-Module Microsoft.Graph.Reports Import-Module Microsoft.Graph.Users
Example code that includes the URI we want to check using a recognized command
Example code that includes a recognized command
$codeToCheck = @"
Get-MgUser -UserId '[email protected]'
"@
Write the example code to a temporary file
$tempScriptPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "tempGraphScript.ps1")
Set-Content -Path $tempScriptPath -Value $codeToCheck
Cache available modules to speed up repeated 'Get-CodeGraphPermissionRequirement' function invocations
$availableModules = @(Get-Module -ListAvailable)
Get the required permissions for the example code
$permissions = Get-CodeGraphPermissionRequirement -scriptPath $tempScriptPath -goDeep -availableModules $availableModules -permType "application", "delegated"
$permissions = Get-CodeGraphPermissionRequirement -scriptPath "C:\Code\CB\Entra\ICTC\Entra\Devices\Beta\GraphCalls.ps1" -goDeep -availableModules $availableModules -permType "application", "delegated"
Output the permissions
$permissions | Out-GridView
Clean up the temporary file
Remove-Item -Path $tempScriptPath
```ps
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.