Windows PowerShell
1193 TopicsThe 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.Solved405KViews0likes19CommentsUsing 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! MathieuSolved151KViews0likes2Commentspwsh.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.0103KViews0likes6CommentsRun 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,101KViews1like7CommentsExchange 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!Solved70KViews0likes5CommentsCannot 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, PatrickSolved68KViews0likes2CommentsAccess 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. #PowerShellSolved64KViews1like7CommentsHow 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