Recent Discussions
Trying to Install-Module AzureAD but Get-PSRepository "WARNING: Unable to find module repositories."
I am running PSVersion 5.1.16299.431 and have set my proxy using NetSH WinHTTP Set Proxy proxy-server="my.proxy.server" I would like to "Install the preview version of the Azure Active Directory Module for Windows PowerShell" as per https://support.office.com/en-gb/article/Manage-who-can-create-Office-365-Groups-4c46c8cb-17d0-44b5-9776-005fced8e618. However, on running Install-Module AzureAD I see "PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'AzureAD'. Try Get-PSRepository to see all available registered module repositories." I can run Register-PSRepository -Default without issue but when I run Get-PSRepository I am faced with "WARNING: Unable to find module repositories." I have been able to run update-help, so I assume I can get online ok. Finally, I tried to Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/ -Proxy my.proxy.server but see the message, "Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later." Can someone please advise what I need to do to be able to successfully Install-Module AzureAD?Solved483KViews0likes22CommentsThe term '...' is not recognized as the name of a cmdlet
Hi, I am new to PowerShell. I am running on Win7 and I have the following module installed. I constantly hit with error: The term '...' is not recognized as the name of a cmdlet, function,.... I tried google around for solutions and there is a lot of articles, but only keeps throwing more error after error. Is there anyway to verify what is missing? Can anyone point me to the right direction, any step-by-step guide? Like what needs to be installed first, or how to install guide? Or how to check what is still required? Thanks.Solved400KViews0likes19CommentsUsing the <Start-ADSyncSyncCycle -PolicyType Delta> command remotely.
Hello all, I have an Exchange Hybrid between Office 365 and Exchange 2013 on-prem. For this to work we have the Azure AD Connect application installed on the Exchange server. It syncs every half hour and in order to force a sync, as needed in certain situations, we login to the server remotely and run the command <Start-ADSyncSyncCycle -PolicyType Delta> to force a sync. Works everytime and this makes sure that the Active Directory users attributes related to mailbox parameters are copied between the cloud and on-prem. I have tried initiating a remote Exchange Powershell session from other Exchange servers using <Import-PSSession> and <Enter-PSSession> after creating a New-PSSession. This all works but I get an error when I run the command <Start-ADSyncSyncCycle -PolicyType Delta> in both Import and Enter PSSession options. Any Ideas on what I am doing wrong would be greatly appreciated. I am new to the ocean of Powershell so I am pretty sure it is user error on my part. ThanksSolved234KViews0likes4CommentsBulk update Azure AD with user attributes from CSV
I am looking for a way to update user attributes (OfficePhone and Department) for about 500 users from a CSV to AzureAD using a powershell. Does anyone know of a script that I could use? I am new here and if I have not given enough information, please let me know. I tried using Set-AzureADUser piping records using a foreach statement from a csv that I imported, but it was throwing up errors. Thanks! JacobSolved196KViews5likes72CommentsWARNING: 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>Solved148KViews0likes13CommentsUsing Start-Process with -ArgumentList
Hi everyone, I am struggling with the use of Start-Process with an argument list. It may seem obvious for some people but I find it hard to see what is going on here. I have to wait for an installation to end before going to the next step hence the Start-Process. Here is the code: #Copy File $bkFolder = "D:\Temp" $bkFolderExist = Test-Path $bkFolder $OptionFile = "D:\Temp\Option.txt" $fileExist = Test-Path $OptionFile If ($bkFolderExist -eq $false) {New-Item -ItemType Directory -Path "d:\Temp" -Force} If ($fileExist -eq $true) {Copy-Item $dsm $bkFolder} else {$env:COMPUTERNAME | Out-File -FilePath %temp%\Log.txt -Append Exit} #Stop service Stop-Service "Service" #Update Start-Process "install.exe" -Wait -ArgumentList "/s, /v`"INSTALLDIR="D:\Software\App" AllUser=1 RebootYeNo="No" AddLocal="Runtime" REBOOT=ReallySuppress /qn /l*v "C:\Temp\Log.txt"`"" #Copy le fichier dsm dans baclient $oldFile = "D:\Temp\File.txt" $Folder = "D:\Folder" if ($fileExist -eq $false) {Copy-Item $oldFile $Folder} #Start service Start-Service "Service" My problem is that I get an error powershell.exe : Start-Process : A positional parameter cannot be found that accepts argument 'INSTALLDIR=D:\Software\App. It is probably a problem with using some quotes. If there is another way to start a process and wait for it to end before going forward, that will work also. Thank a bunch for the help! MathieuSolved143KViews0likes2CommentsGuest credentials for Windows trial VM
Hello, I have set up a virtual machine using the Windows 10 trial VM for Hyper-V (https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/, preview 15.15). I would like to use Powershell Direct to run Powershell scripts on my VM. I believe I've successfully enabled PSRemoting. I enter the command "Enter-PSSession -VMName $VMname" on my host. I am then asked to enter the credentials of the guest machine. I tried searching in the installation instructions and learned that one can sign in as IEUser/Passw0rd! by default. However this doesn't seem to be a valid credential. I can't tell if there is a default credential, a credential is stored somewhere on the computer, or I need to make a credential. I would greatly appreciate your advice on the matter. Thank you.136KViews0likes2CommentsPowershell: how to use an if condition with true false
Highlighted , how is $ True is equal to false? Same way, why does typecasting 'False' to boolean is evaluating to true? What is the right way to use if condition that can receive $True or 'True or $False or 'False' $Stat = $True if($Stat -eq 'fal'){Write-Host "if executed"}else{Write-Host "else block"} if($Stat -eq $False){Write-Host "if executed"}else{Write-Host "else block"} if($Stat -eq 'False'){Write-Host "if executed"}else{Write-Host "else block"} $Stat = 'True' if($Stat -eq 'False'){Write-Host "if executed"}else{Write-Host "else block"} if($Stat -eq 'True'){Write-Host "if executed"}else{Write-Host "else block"} if($Stat -eq $True){Write-Host "if executed"}else{Write-Host "else block"} if($Stat -eq $False){Write-Host "if executed"}else{Write-Host "else block"} $Stat = $False if($Stat){Write-Host "if executed"}else{Write-Host "else block"} $Stat = 'False' if($Stat){Write-Host "if executed"}else{Write-Host "else block"} if([bool]$Stat){Write-Host "if executed"}else{Write-Host "else block"} $dd = [bool]$Stat if($dd){Write-Host "if executed"}else{Write-Host "else block"}Solved126KViews0likes6CommentsRun Windows Updates with Powershell Remotely
Hi, I'm kind of new to Powershell, and trying to automate some stuff. I found one nice Powershell module named PSWindowsUpdate to manage Windows Updates. I need to create some automated updating for my servers, which are around 50. Everything runs fine locally, but I started to search on how to write a script to do it remotely, but from what I've read that has a lot of issues, due to permissions related to remote updating. I create a remote session with "Enter-PSSession -ComputerName <servername>. But when I run the command "Install-WindowsUpdate -KBArticleID <kbID> -AcceptAll -Install" I get this error: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) + CategoryInfo : NotSpecified: (:) [Get-WindowsUpdate], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,PSWindowsUpdate.GetWindowsUpdate" I've been reading and understand that the problem is related to a permissions issue on powershell and remote updating. I've read some topics about it, and in some there a solution presented, which is JEA. So I've followed this code to run on the server side: " New-PSSessionConfigurationFile -RunAsVirtualAccount -Path .\VirtualAccount.pssc # Note this will restart the WinRM service: Register-PSSessionConfiguration -Name 'VirtualAccount' [-ShowSecurityDescriptorUI] -Path .\VirtualAccount.pssc -Force # Check the Permission property: Get-PSSessionConfiguration -Name 'VirtualAccount' # Those users will have full unrestricted access to the system! But I got this error: "Register-PSSessionConfiguration : A positional parameter cannot be found that accepts argument '[-ShowSecurityDescriptorUI]'. At line:1 char:1 + Register-PSSessionConfiguration -Name 'VirtualAccount' [-ShowSecurity ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Register-PSSessionConfiguration], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RegisterPSSessionConfigurationCommand" So, my question is if everyone knows why do I get this error while registering the PSSessionConfiguration and also, if someone has any different solution for the topic. ThanksSolved112KViews0likes6CommentsPowershell > Output to .txt as one string
I have a powershell script that loops a fileshare and reports the properties of all the files. This part reports to a .txt file: Get-ChildItem -Recurse $source | ?{-not $_.PSIsContainer} | ForEach-Object {Audit-File $_} | Sort-Object fullname | Select FullName,CreationTime,LastWriteTime,Length,Owner | Out-File C:\filename.txt The output is something like this: FullName : C:\temp\testfile CreationTime : 30-6-2017 13:34:16 LastWriteTime : 8-9-2014 17:15:57 Length : 5752832 Owner : BLA\bla.bla Author : But I would like to have something like this: FullName,C:\temp\testfile,CreationTime,30-6-2017 13:34:16,LastWriteTime,8-9-2014 17:15:57,Length,5752832,Owner,BLA\bla.bla,Author So one line for each record. I cannot use a .csv as this cannot handle things like "é", etc.Solved104KViews0likes4CommentsRun PowerShell with different credentials without prompt on remote machines
I want to run the below command using different user (domain\administrator) without prompting to enter password, basically I want to append the credentials in this command if required. powershell.exe -executionpolicy Bypass -file %script% Expecting: not sure this can be done. powershell.exe -executionpolicy Bypass -file %script% -Credentials -Username user -Password password Thanks,97KViews1like7Commentspwsh.exe Not recognized, even after adding path?
Hello, I am trying to use PowerShell to install/run Node Red. No experience with PS and very little with CMD. First issue: xxxx cannot be loaded. The file xxxx is not digitally signed. You cannot run this script on the current system..." I went to the Microsoft link provided (https:/go.microsoft.com/fwlink/?LinkID=135170) to read about Execution_Policies I tried to change the policy for a single session using: pwsh.exe -ExecutionPolicy AllSigned To which I got the error: pwsh.exe : The term 'pwsh.exe' is not recognized as the name of a cmdlet, function, script file, or operable program..." Looking that up, I found that my 'Environment Variables' were not correct. Specifically, Powershell was not in my path variable. (btw, Why not? There's all types of weird stuff there, why is PS not there?) So I added it to my path. I copy/pasted the .exe location C:\Windows\System32\WindowsPowerShell\v1.0 It still says pwsh.exe is not recognized. Any ideas? Edition Windows 10 Home Version 21H2 Installed on 4/3/2021 OS build 19044.2251 Experience Windows Feature Experience Pack 120.2212.4180.094KViews0likes6CommentsPowershell script to enable inheritance for the folders created in NTFS share
Hi, We have a NTFS Share folder wherein we are creating all the users' homeDirectories (homefolder) within the enterprise using Oracle identity management tool. Homefolder creation is working good. But, we are having issues with the permissions. -- It doesn't inherit permissions from the parent folder. -- sometimes the owner also doesn't get the permissions. Is there a way for us to check the current permissions and enable inheritance for the folders created in the share and all the child items within. We have a lot of homefolders and not able to figureout how to do it via Powershell. Any input will be greatly appreciated. Thanks in advance.Solved92KViews0likes13CommentsSend-MailMessage with Powershell and Exchange Online with MFA
I am having difficulty with one of my scripts that blocks a user from signing into Office 365 then sends an email to my manager and HR when the script has completed. I downloaded the Exchange Online Powershell Module and connected to EXOPSSession but I receive an error message that I need a secure connection to send a message. I know I created a secure connection with the old way to connect with Exchange Online but not sure how to do it when I connect to EXOPSession. Can someone please point me in the right direction?84KViews0likes4CommentsStore password in Windows credential manager and use it in Powershell
On the #ESPC16 in Vienna someone is showing a way to store credentials in the Windows credential manager and then use is in Powershell to connect to Exchange / SharePoint / Azure… online. It was a very simple and I will use it for some scheduled tasks. But i don’t remember how he does it and I didn’t find such a good and simple way in the net. Anyone has it also seen or use it before?Solved79KViews2likes8CommentsExchange Online - Change primary email address, name and alias of a shared mailbox
Hi All, I have been asked by HR to change the email address, name and alias of a few shared mailboxes that were set up last year. For example, I need to change "jobs-mathssec@domain.com" into "jobs-maths@domain.com", and the name/alias consequently. I need to do the same for 9 other mailboxes which have "sec" in the email address. Is it safe to run the following command: set-mailbox jobs-mathssec@domain.com -EmailAddress "SMTP:jobs-maths@domain.com","smtp:jobs-maths@domain.onmicrosoft.com" -Name jobs-maths -DisplayName jobs-maths -Alias jobs-maths Will the old name stay in other properties? I would need to keep all the old emails sent to the old address. Thank you in advance for your help!Solved67KViews0likes5CommentsCannot convert 'System.Object[]' to the type 'Microsoft.ActiveDirectory.Management.ADUser'
Hi together, i'm quite new to Powershell and need a little 'shove'. :-D What i want to achive: Setting the Manager of a User based on the "ManagedBy" attribute of an OU. What my Script Snippet looks like: # Getting one user & build correct variables (already working for some other scripts) $user = Get-ADUser -Identity ABC $userOUDistName = ($user.DistinguishedName -split "=",3)[-1] $UserOUName = $userOUDistName.Split(",") # Explanation # $user contains the complete information of the user $userOUDistName contains a string like "Department,OU=Users,OU=TEST,DC=DOMAIN,DC=de" So "Department" is the name of OU. $userOUName contains the splitted strings. $userOUName[0] contains the exact word of the OU (in this case "Department" ### Test 1 ### # Fill in the ManagedBy into the new variable $manager # $manager = (Get-ADOrganizationalUnit -Filter * -Properties * | Where-Object {$_.name -eq $userOUName[0]}).ManagedBy # so after this i know who should be the manager for the user # #not working# Set-ADUser -Identity $user.SamAccountName -Manager $manager Error: Set-ADUser : Cannot convert 'System.Object[]' to the type 'Microsoft.ActiveDirectory.Management.ADUser' required by parameter 'Manager'. Specified method is not supported. At line:1 char:52 + Set-ADUser -Identity $user.SamAccountName -Manager $manager + ~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Set-ADUser], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.SetADUser #working# # writing the exact same value by hand into a new variable # $test = 'Department,OU=Users,OU=TEST,DC=DOMAIN,DC=de' Set-ADUser -Identity $user.SamAccountName -Manager $test Error: #working# Set-ADUser -Identity $user.SamAccountName -Manager 'CN=NAME\, NAME,OU=NAME,OU=NAME,OU=NAME,DC=NAME,DC=de' I already tried this (the same results as before) $manager = (Get-ADOrganizationalUnit -Filter * -Properties * | Where-Object {$_.name -eq $userOUName[0]}).ManagedBy | Out-String Please provide me some hint.. :-D Thank you very much in advance. Greetings, PatrickSolved67KViews0likes2CommentsAccess denied when I want create to File in Powershell
Hi, Please, your help me! I have problem to access denied, when i want create to file. I have the account in the group administrator. I valued the permission in the tab security and i have administrator permission. PS U:\> $cre | Export-Clixml -Path C:\ Export-Clixml : Acceso denegado a la ruta de acceso 'C:\'. En línea: 1 Carácter: 8 + $cre | Export-Clixml -Path C:\ + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (:) [Export-Clixml], UnauthorizedAccessException + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportClixmlCommand Regards. #PowerShellSolved63KViews1like7CommentsHow to install the .exe installer with Powershell on remote machine in non-interactive mode
Hi All, I need a help to install the one .exe installer on my remote machines which required be setup with Azure Devops activity. I want for exe but not for msi. I tried below option but couldn't make it successful. PowerShell Script: Invoke-Command -ComputerName $computer -ScriptBlock { Start-Process C:\Users\someexe.exe -ArgumentList /silent -Wait -NoNewWindow } Error: Start-Process : This command cannot be run due to the error: The requested operation requires elevation. At line:16 char:1 + Start-Process C:\Users\someexe.exe -ArgumentLi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand @All please help me on this.Solved63KViews0likes6Comments
Events
Recent Blogs
- One new resource, logging improvements and bugfixes. This is what SharePointDsc v5.2 is bringing to the table!May 12, 20227.5KViews1like0Comments
- 2 MIN READThis article describes a solution of an issue I have been troubleshooting today, where switching to an AllSigned execution policy resulted in the "This publisher is explicitly not trusted on your sys...Mar 18, 20226.4KViews1like1Comment