azure
99 TopicsWARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/.....' is not valid
Hello, I was trying install the PowerShell Module to a server and getting error message with not valid url. Debug log attached. PS C:\windows\system32> Install-Module SharePointPnPPowerShellOnline -Force -Debug DEBUG: 00:00:00.0000002 Calling New() : MethodName = 'GetDynamicOptions' Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a DEBUG: 00:00:00.0000300 Force: True DEBUG: 00:00:00.0000445 Debug: True DEBUG: 00:00:00.0000573 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:00.0011177 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1 DEBUG: 00:00:00.0019006 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0039875 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0100688 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0100914 Force: True DEBUG: 00:00:00.0101568 Debug: True DEBUG: 00:00:00.0101735 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:00.0109507 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1 DEBUG: 00:00:00.0115616 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0144311 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0181073 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0181315 Force: True DEBUG: 00:00:00.0181464 Debug: True DEBUG: 00:00:00.0181607 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:00.0188111 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1 DEBUG: 00:00:00.0194829 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0243662 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0276450 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0276668 Force: True DEBUG: 00:00:00.0276801 Debug: True DEBUG: 00:00:00.0276931 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:00.0284428 INVOKING PowerShell Fn Get-DynamicOptions with args Install that has length 1 DEBUG: 00:00:00.0290814 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0338093 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:02.4736146 Calling SearchForPackages. Name='SharePointPnPPowerShellOnline' VERBOSE: Using the provider 'PowerShellGet' for searching packages. Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a DEBUG: 00:00:02.4747220 PackageProvider::FindPackage with name SharePointPnPPowerShellOnline DEBUG: 00:00:02.4749508 Calling SearchForPackages After Select 1 DEBUG: 00:00:07.4799484 Calling New() : MethodName = 'FindPackage' DEBUG: 00:00:07.4800187 ProviderName: PowerShellGet DEBUG: 00:00:07.4800527 Type: Module DEBUG: 00:00:07.4800683 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:07.4801181 Force: True DEBUG: 00:00:07.4801320 Debug: True DEBUG: 00:00:07.4801456 Scope: AllUsers DEBUG: 00:00:07.4801619 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:07.4810098 INVOKING PowerShell Fn Find-Package with args System.String[], , , that has length 4 DEBUG: 00:00:07.4832297 In PowerShellGet Provider - 'Find-Package'. DEBUG: 00:00:07.4839335 OPTION: ProviderName => PowerShellGet DEBUG: 00:00:07.4841374 OPTION: Type => Module DEBUG: 00:00:07.4843299 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:07.4848048 OPTION: Force => True DEBUG: 00:00:07.4849908 OPTION: Debug => True DEBUG: 00:00:07.4851678 OPTION: Scope => AllUsers DEBUG: 00:00:07.4853432 OPTION: Name => SharePointPnPPowerShellOnline VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories. VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'. VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'. DEBUG: 00:00:07.4907353 PackageProvider::FindPackage with name SharePointPnPPowerShellOnline DEBUG: 00:00:07.4932458 Calling 'NuGet'::'FindPackage' - name='SharePointPnPPowerShellOnline', requiredVersion='',minimumVersion='', maximumVersion='''. DEBUG: 00:00:07.4932826 Iterating 'SharePointPnPPowerShellOnline'. DEBUG: 00:00:07.4935582 There are '0' registered sources in 'NuGet' provider. DEBUG: 00:00:07.4936600 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider. DEBUG: 00:00:09.6490403 Source 'https://www.powershellgallery.com/api/v2' is validated. DEBUG: 00:00:09.6491100 Calling 'NuGetRequest'::'GetPackageById', 'SharePointPnPPowerShellOnline'. DEBUG: 00:00:10.9249696 Calling 'HttpClientPackageRepository'::'FindPackagesById', 'SharePointPnPPowerShellOnline'. DEBUG: 00:00:10.9250551 Calling 'NuGetClient'::'FindPackage'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'' for ''. DEBUG: 00:00:10.9253313 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=0&$top=40'. DEBUG: 00:00:12.6410092 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=0&$top=40'. DEBUG: 00:00:12.6506047 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=80&$top=40'. DEBUG: 00:00:12.6506065 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=40&$top=40'. DEBUG: 00:00:12.6506379 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=120&$top=40'. DEBUG: 00:00:12.6508283 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=160&$top=40'. DEBUG: 00:00:13.9261883 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=120&$top=40'. DEBUG: 00:00:13.9265741 '0' packages received in the last request. DEBUG: 00:00:14.6035386 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=80&$top=40'. DEBUG: 00:00:14.6036603 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=160&$top=40'. DEBUG: 00:00:14.6038273 '0' packages received in the last request. DEBUG: 00:00:14.6039490 '0' packages received in the last request. DEBUG: 00:00:15.6130985 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=40&$top=40'. DEBUG: 00:00:15.6178721 '30' packages received in the last request. VERBOSE: Total package yield:'1' for the specified package 'SharePointPnPPowerShellOnline'. DEBUG: 00:00:15.6207643 Completed iterating for 'SharePointPnPPowerShellOnline'. DEBUG: 00:00:15.6470655 Done calling powershell «Find-Package» «PSModule» DEBUG: 00:00:15.6537227 Calling New() : MethodName = 'GetInstalledPackages' DEBUG: 00:00:15.6537527 ProviderName: PowerShellGet DEBUG: 00:00:15.6537681 Type: Module DEBUG: 00:00:15.6537823 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:15.6537965 Force: True DEBUG: 00:00:15.6538090 Debug: True DEBUG: 00:00:15.6538215 Scope: AllUsers DEBUG: 00:00:15.6538346 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:15.6543655 INVOKING PowerShell Fn Get-InstalledPackage with args SharePointPnPPowerShellOnline, 3.19.2003.0, , that has length 4 DEBUG: 00:00:15.6550981 In PowerShellGet Provider - 'Get-InstalledPackage'. DEBUG: 00:00:15.6553113 OPTION: ProviderName => PowerShellGet DEBUG: 00:00:15.6554848 OPTION: Type => Module DEBUG: 00:00:15.6556921 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:15.6558915 OPTION: Force => True DEBUG: 00:00:15.6560733 OPTION: Debug => True DEBUG: 00:00:15.6562478 OPTION: Scope => AllUsers DEBUG: 00:00:15.6564270 OPTION: Name => SharePointPnPPowerShellOnline DEBUG: 00:00:17.6364439 PowerShell Script 'PSModule' Function 'Get-InstalledPackage' returns null. DEBUG: 00:00:17.6372045 Done calling powershell «Get-InstalledPackage» «PSModule» Confirm Are you sure you want to perform this action? Performing the operation "Install Package" on target "Package 'SharePointPnPPowerShellOnline' version '3.19.2003.0' from 'PSGallery'.". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a DEBUG: 00:00:42.9836594 Calling New() : MethodName = 'InstallPackage' DEBUG: 00:00:42.9836941 ProviderName: PowerShellGet DEBUG: 00:00:42.9837229 Type: Module DEBUG: 00:00:42.9837425 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:42.9837575 Force: True DEBUG: 00:00:42.9837714 Debug: True DEBUG: 00:00:42.9837853 Scope: AllUsers DEBUG: 00:00:42.9837996 Name: SharePointPnPPowerShellOnline DEBUG: 00:00:42.9845292 INVOKING PowerShell Fn Install-Package with args NuGet|SharePointPnPPowerShellOnline|3.19.2003.0|https://www.powershellgallery.com/api/v2|Module that has length 1 DEBUG: 00:00:42.9862372 In PowerShellGet Provider - 'Install-Package'. DEBUG: 00:00:42.9869454 In PowerShellGet Provider - 'Install-PackageUtility'. DEBUG: 00:00:42.9871604 The FastPackageReference is 'NuGet|SharePointPnPPowerShellOnline|3.19.2003.0|https://www.powershellgallery.com/api/v2|Module'. DEBUG: 00:00:42.9875296 OPTION: ProviderName => PowerShellGet DEBUG: 00:00:42.9878200 OPTION: Type => Module DEBUG: 00:00:42.9880217 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:42.9882389 OPTION: Force => True DEBUG: 00:00:42.9884634 OPTION: Debug => True DEBUG: 00:00:42.9887816 OPTION: Scope => AllUsers DEBUG: 00:00:42.9889883 OPTION: Name => SharePointPnPPowerShellOnline VERBOSE: The installation scope is specified to be 'AllUsers'. VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'. DEBUG: 00:00:42.9903760 ArtfactType is Module VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'. VERBOSE: Downloading module 'SharePointPnPPowerShellOnline' with version '3.19.2003.0' from the repository 'https://www.powershellgallery.com/api/v2'. DEBUG: 00:00:44.6681094 Calling 'NuGet'::'InstallPackage', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\U2hhcmVQb2ludFBuUFBvd2VyU2hlbGxPbmxpbmU=\My4xOS4yMDAzLjA=\aH R0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='. DEBUG: 00:00:44.6683081 Calling 'NuGetRequest'::'GetPackageByFastpath', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\U2hhcmVQb2ludFBuUFBvd2VyU2hlbGxPbmxpbmU=\My4xOS4yMDAzLjA=\aH R0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='. DEBUG: 00:00:44.6684489 Calling 'NuGetRequest'::'ResolvePackageSource', 'https://www.powershellgallery.com/api/v2'. DEBUG: 00:00:44.6684779 Calling 'NuGetRequest'::'FindRegisteredSource', 'https://www.powershellgallery.com/api/v2'. DEBUG: 00:00:44.6685047 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider. DEBUG: 00:00:48.8501172 Calling 'HttpClientPackageRepository'::'FindPackage', 'SharePointPnPPowerShellOnline'. DEBUG: 00:00:48.8501805 Calling 'NuGetClient'::'FindPackage'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'' for ''. DEBUG: 00:00:48.8502893 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=0&$top=40'. DEBUG: 00:00:52.1960762 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=0&$top=40'. DEBUG: 00:00:52.2099144 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=40&$top=40'. DEBUG: 00:00:52.2100909 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=120&$top=40'. DEBUG: 00:00:52.2100942 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=80&$top=40'. DEBUG: 00:00:52.2101002 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=160&$top=40'. DEBUG: 00:00:53.6597300 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=80&$top=40'. DEBUG: 00:00:53.6599788 '0' packages received in the last request. DEBUG: 00:00:54.1614418 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=120&$top=40'. DEBUG: 00:00:54.1614464 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=160&$top=40'. DEBUG: 00:00:54.1616464 '0' packages received in the last request. DEBUG: 00:00:54.1618585 '0' packages received in the last request. DEBUG: 00:00:55.6163522 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip=40&$top=40'. DEBUG: 00:00:55.6251832 '30' packages received in the last request. DEBUG: 00:00:55.6271792 'Package version' is '3.19.2003.0'. DEBUG: 00:00:55.6272337 'Request's Destination' is 'C:\Users\kvanoop\AppData\Local\Temp\398316225'. DEBUG: 00:00:55.6272632 Calling 'NuGetClient'::'GetPackageDependencies'. DEBUG: 00:00:55.6273996 Returning the call 'NuGetClient'::'GetPackageDependencies'. DEBUG: 00:00:55.6275763 Calling 'NuGetClient'::'InstallPackage'. VERBOSE: InstallPackage' - name='SharePointPnPPowerShellOnline', version='3.19.2003.0',destination='C:\Users\kvanoop\AppData\Local\Temp\398316225' VERBOSE: DownloadPackage' - name='SharePointPnPPowerShellOnline', version='3.19.2003.0',destination='C:\Users\kvanoop\AppData\Local\Temp\398316225\SharePointPnPPowerShellOnline\SharePoi ntPnPPowerShellOnline.nupkg', uri='https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003'. VERBOSE: An error occurred while sending the request. DEBUG: 00:00:57.0212206 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext() VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' for '2' more times VERBOSE: An error occurred while sending the request. DEBUG: 00:00:57.8874097 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext() VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' for '1' more times VERBOSE: An error occurred while sending the request. DEBUG: 00:00:58.7402606 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext() VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' for '0' more times VERBOSE: Downloading package 'SharePointPnPPowerShellOnline' failed, please make sure 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' is accessable. WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' is not valid. Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a PS C:\windows\system32>Solved152KViews0likes13CommentsFailed downloading Az and other modules for powershell
Hello, I am attempting to install the Az module for powershell. I haven't had issues in the past but now I get errors when trying to do so and I have tried many ways to do this. It seems like an issue on the powershellgallery site but I am not 100% sure. Here's my situation On the machine as an administrator Running powershell.exe as an adminsitrator Attempting this on a client server and a local server (where I previously was able to do this) so does NOT appear to be proxy, firewall or security related in any way I click yes to run from untrusted repository (always have, never been an issue) I receive the follow error: WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/Az.Accounts/1.7.4' is not valid. PackageManagement\Install-Package : Package 'Az.Accounts' failed to download. At C:\Program Files\WindowsPowershell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21 + ... $null = PackageManagement\Install-Package @PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (C:\Users\{username}....Accounts.nupkg:String) [Install-Package], Exception + FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.Powershell.PackageManagement.Cmdlets.InstallPackage I have attempted many of the switches -Force -AllowClobber etc ... attempted to install by downloading locally but not sure I am doing that right as it doesn't seem to work with the instructions I have found around the web. This started sometime last week, perhaps Thursday. I'm at a loss, been trying this for way too long. Any insight? Thanks ahead of time! SSolved64KViews1like14CommentsHow to get rid of warning 'Unable to acquire token for tenant 76a47f06...' with Connect-AzAccount?
How do I get rid of the warning 'WARNING: Unable to acquire token for tenant 76a47f06...' permanently and forever when I log in with 'Connect-AzAccount'? I have already deleted the file "C:\Users\RContosoUser\.Azure\AzureRmContext.json". No improvement. I have already logged in with 'Connect-AzAccount --UseDeviceAuthentication'. No improvement. I also tried 'Clear-AzContext' and 'Remove-AzContext'. No improvement. When I log in, I always get (partially anonymized here) the following message/warning: PS C:\Users\RContosoUser> Connect-AzAccount -UseDeviceAuthentication WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code DSU000000 to authenticate. WARNING: TenantId 'd4b72ec1' contains more than one active subscription. First one will be selected for further use. To select another subscription, use Set-AzContext. WARNING: Unable to acquire token for tenant '76a47f06' with error 'You must use multi-factor authentication to access tenant 76a47f06, please rerun 'Connect-AzAccount' with additional parameter '-TenantId 76a47f06'.' WARNING: Unable to acquire token for tenant '80fab529' with error 'SharedTokenCacheCredential authentication unavailable. Token acquisition failed for user email address removed for privacy reasons. Ensure that you have authenticated with a developer tool that supports Azure single sign on.' WARNING: Unable to acquire token for tenant '76a47f06' with error 'You must use multi-factor authentication to access tenant 76a47f06, please rerun 'Connect-AzAccount' with additional parameter '-TenantId 76a47f06'.' WARNING: Unable to acquire token for tenant '80fab529' with error 'SharedTokenCacheCredential authentication unavailable. Token acquisition failed for user email address removed for privacy reasons. Ensure that you have authenticated with a developer tool that supports Azure single sign on.' Account SubscriptionName TenantId Environment ------- ---------------- -------- ----------- email address removed for privacy reasons MPN - R ContosoUser d4b72ec1 AzureCloud I no longer have any access at all to the tenants '76a47f06' and '80fab529' mentioned in the warning. I cannot contact anyone there to remove me from the AAD user directory. So what can I do to get rid of these warnings?Solved43KViews0likes8CommentsMSOnline not working in PowerShell 7
Greetings, I have installed Windows Terminal with PowerShell 7.1.1 for use with requests related to work as a L1 support tech. I use PowerShell mainly for Exchange-related affairs but from time to time I need to connect to Azure services, for example, to retrieve a list of users easily. To do this, I use the module MSOnline which I installed on my PowerShell instance. The problem appears when I try using Connect-MsolService on PowerShell 7.1.1 I get an error saying the cmdlet does not exist, but when I list available modules it does show in the list. Connect-MsolService works as intended on 5.1 shipped with Windows, which has been my workaround for the past weeks. But I'd prefer having this up and running. TIA for any answers, and apologies if my English has minor errors, as it is not my mother tongue.Solved27KViews0likes6CommentsInstall-Module MSOnline - not working
Hi all, I am struggling to install: Install-Module MSOnline I get: I have tried: Get-PSRepository WARNING: Unable to find module repositories. When I run: Register-PSRepository -Default I get no error but when trying to run Get-PSRepository again i get WARNING: Unable to find module repositories. Any ideas on how to fix this?Solved21KViews0likes1CommentNeed a PowerShell Script to add multiple users to Azure Ad using csv file.
Script that i have tried its showing the below error. And Unable to fix it. Myscript:- #Import-Module AzureAD #Already installed # Set the path to your CSV file $csvPath = "C:\Users\pathto\newuserscript.csv" # Set the desired password length $passwordLength = 10 # Read the CSV file $users = Import-Csv -Path $csvPath # Connect to Azure AD #Connect-AzureAD # Loop through each user in the CSV file foreach ($user in $users) { # Generate a random password $password = [System.Web.Security.Membership]::GeneratePassword($passwordLength, 2) # Create a new user object $newUserParams = @{ DisplayName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName PasswordProfile = @{ Password = $password ForceChangePasswordNextSignIn = $true } } # Add the user to Azure AD New-AzureADUser @newUserParams # Output the user details and password to the console Write-Output "User created: $($user.DisplayName) ($($user.UserPrincipalName))" Write-Output "Password: $password" # Export the user details and password to a CSV file $output = [PSCustomObject]@{ DisplayName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName Password = $password } $output | Export-Csv -Path "C:\Users\pathto\userlistpw.csv" -force -NoTypeInformation } Error:- Unable to find type [System.Web.Security.Membership]. At line:13 char:17 + $password = [System.Web.Security.Membership]::GeneratePassword($p ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Web.Security.Membership:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound New-AzureADUser : Cannot bind argument to parameter 'DisplayName' because it is null. At line:26 char:17 + New-AzureADUser @newUserParams + ~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [New-AzureADUser], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Open.AzureAD16.PowerShell.NewUser User created: () Password: Note:- My csv file contain only Display name , UPN , Block sign in column filled, Else other are blank. THANK YOU!!Solved14KViews0likes29CommentsGet-AzAccessToken "Method not found: Void..."
When running the script below, I get the following error: Get-AzAccessToken : Method not found: 'Void Azure.Identity.BrokeredAuthentication.SharedTokenCacheCredentialBrokerOptio ns..ctor(Azure.Identity.TokenCachePersistenceOptions)'. Import-Module Microsoft.Graph.Authentication Import-Module Az.Accounts function Connect-MgGraphViaCred { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $credential, [string] $tenant = "customersbank.com" ) # connect to Azure using credentials $param = @{ Credential = $credential Force = $true } if ($tenant) { $param.tenant = $tenant } Connect-AzAccount # retrieve token for MSGraph $token = (Get-AzAccessToken -ResourceTypeName MSGraph -ErrorAction Stop).token # convert token string to securestring if new version of Connect-MgGraph is used if ((Get-Help Connect-MgGraph -Parameter accesstoken).type.name -eq "securestring") { $token = ConvertTo-SecureString $token -AsPlainText -Force } # use token for connecting to Microsoft Graph $null = Connect-MgGraph -AccessToken $token -ErrorAction Stop } $User = "##username##" $PWord = ConvertTo-SecureString -String "##password##" -AsPlainText -Force $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord Connect-MgGraphViaCred -credential $Credential I am running the script inside a Power Automate Desktop flow. When I run it on my Win10 machine, it runs fine, but it needs to run on a Windows Server 2019 OS, which is where it fails. I am assuming that it has something to do with the version of the Connect-AZAccount or Get-AZAccessToken commands. P.A.D. only supports PowerShell 5, so I am forced to use that version. The server's version of PowerShell is slightly older but, from what I understand, the only way to update it is via Windows Update and that says there are no new updates. Is it possible that this just won't run on Windows Server? Major Minor Build Revision ----- ----- ----- -------- 5 1 19041 3031 - Win 10 Laptop 5 1 17763 4720 - Server 2019 Module Name Win10 Version Server 2019 Version Az 9.7.1 10.2.0 Az.Accounts 2.12.2 2.12.5Solved13KViews2likes10CommentsPowerShell Script to disjoin on-prem AD and join AAD
I'm in the process of planning an on-prem AD to AAD change for ~148 users. I'd like to not have to run around and manually disjoin and rejoin devices. Does anyone know of a PowerShell script that would help automate this?Solved12KViews1like4CommentsRe-using computer account with Add-Computer
I am having an issue getting computers to rejoin the domain after they are reimaged. It has been working up until Windows 11 22H2. I found that KB5020276 changed re-using computer names, I have done all the required changes and the script still will not work but I am able to add the computer back to the domain if I use the GUI. Use the same network account in both. The account is a member of the Domain Admins. $domain= '<domain>' $password= "<password>" | ConvertTo-SecureString -asPlainText -Force #enter user account that will be used to join domain $user= '$domain\<user>' $cred= New-Object System.Management.Automation.PSCredential($user,$password) #edit for OU path $oupath = '<path>' #add computer to OU Add-Computer -domainname $domain -oupath $oupath -Credential $cred -ErrorAction silentlycontinue #add computer to domain Add-Computer -DomainName $domain -Credential $cred Script output Microsoft Windows [Version 10.0.22621.1635] (c) Microsoft Corporation. All rights reserved. C:\Users\Administrator>powershell -nologo -executionpolicy bypass -noprofile -file C:\test\CUR_Join.ps1 Add-Computer : Computer 'TEST' failed to join domain '<domain>' from its current workgroup 'WORKGROUP' with following error message: The group name could not be found. At C:\test\CUR_Join.ps1:17 char:1 + Add-Computer -domainname $domain -oupath $oupath -Credential $cred + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (TEST:String) [Add-Computer], InvalidOperationException + FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand Add-Computer : Computer 'TEST' failed to join domain '<domain>' from its current workgroup 'WORKGROUP' with following error message: An account with the same name exists in Active Directory. Re-using the account was blocked by security policy. At C:\test\CUR_Join.ps1:21 char:1 + Add-Computer -DomainName $domain -Credential $cred + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (TEST:String) [Add-Computer], InvalidOperationException + FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand NetSetup.log using script 05/09/2023 09:18:50:880 IsLegacyAccountReuseSetInRegistry returning: 'FALSE''. 05/09/2023 09:18:50:880 NetpManageMachineAccountWithSid: The computer account already exists in Active Directory.Re-using the account was blocked by security policy. NetSetup.log using GUI 05/09/2023 09:22:15:333 IsLegacyAccountReuseSetInRegistry returning: 'FALSE''. 05/09/2023 09:22:15:333 NetpCheckIfAccountShouldBeReused: Matching Owner and current user SIDs. Allowing re-use of account.12KViews0likes8Comments