I am trying to install Windows 10 IoT on my Raspberry Pi 2. The PowerShell documentation tells me to put in this:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value <minwinpc>
However, when I put it into my Windows 7 PowerShell, this comes out:
At line:1 char:54
+ Set-Item WSMan:\localhost\Client\TrustedHosts -Value <minwinpc>
+ ~
The '<' operator is reserved for future use.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported
How do I fix this?
You need to use quotes rather than < > around the name of the device (minwinpc)
Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'minwinpc'
Related
When running the following on one of our Windows machine
$name = "My task"
Stop-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue
I get this error:
Stop-ScheduledTask : Cannot connect to CIM server. The system cannot find the file specified.
+ Stop-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (PS_ScheduledTask:String) [Stop-ScheduledTask], CimJobException
+ FullyQualifiedErrorId : CimJob_BrokenCimSession,Stop-ScheduledTask
It does not look like a permission issus since it would look more like
Stop-ScheduledTask : Access is denied.
+ [void](Stop-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (PS_ScheduledTask:Root/Microsoft/...p_ScheduledTask) [Stop-Schedul
edTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070005,Stop-ScheduledTask
A couple of facts to help:
I'm not running this remotely
Get-ScheduledTask will throw the same CimJob_BrokenCimSession error
Are you an administrator on the system? The error says permission denied (Misread OP)
When troubleshooting, it generally helps if you don't have -erroraction silentlycontinue if you actually want to see what's erroring. Obviously, you don't have it in a try/catch block, so you can see the error, but having the option to suppress errors doesn't make sense here.
More suggestions:
Are you running this command remotely? If you're running it against many servers, check your server list.
What happens if you get all the tasks, e.g. $tasks = get-scheduledtask, then reference the one you want with $tasks | where taskname -like "whatever" | stop-scheduledtask (or its index number in the array, e.g. $tasks[5]).
I didn't get any errors when I ran the preceding command against tasks that weren't running, but perhaps it does return an error in some cases if the task isn't in the running state.
I'm trying to start this from my Powershell script:
Import-Csv -Path $filecur -Delimiter ";" | Export-Csv -Path $filenext -Delimiter ";" -NoTypeInformation -Encoding Unicode -UseQuotes Never
But after executing Powershell script command promt show the next text:
Export-Csv : A parameter cannot be found that matches parameter name 'UseQuotes'.
At C:\Users\vad\Desktop\QuatesDeleter.ps1:4 char:116
+ ... ilenext -Delimiter ";" -notypeinfo -Encoding Unicode -UseQuotes Never
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Export-Csv], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ExportCsvCommand
How can I solve this problem?
My computer is running under Windows 7, SP1, X64, PowerShell version is 5.1.14409.1005.
In Microsoft documentation I could't find some information about this problem
Link here
It's neccesary to install PowerShell version 7.x (PowerShell Core).
I am very new to PowerShell. I am using Windows 7 and PowerShell 5.
What I am trying to do is:
display all the network adapters for a system.
Disable all of them
Enable all of them
I am using this code to display all the network adapters:
$wmi = get-wmiobject win32_networkadapter
This displays all the network adapters and their status.
But the problem is that, I am not able to disable all pf the network adapters together using this command.
$wmi.disable()
This statement gives me the error:
Method invocation failed because [Selected.System.Management.ManagementObject] does not contain a method named 'disable'.
At line:1 char:1
+ $wmi.disable()
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (disable:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Is there any alternative way to display all the network adapters and disable or enable all of them together ?
Thanks in advance!
It's because you're calling .disable() on the collection of network adapters and this method only exists for a single network adpater.
Try this:
$wmi = get-wmiobject win32_networkadapter
$wmi | Foreach-Object {
Write-Host "Disabling: $($_.name)"
$_.disable()
}
I'm running a microsoft/windowsservercore container on Windows 10 and trying to rename the network adapter from within the container by any means possible. This would be a simple task via PowerShell with something like the following:
Rename-NetAdapter -Name 'Ethernet 2' -NewName 'WuTangLan'
but that gives the following error:
Rename-NetAdapter : A general error occurred that is not covered by a more specific error code.
At line:1 char:1
+ Rename-NetAdapter -Name 'Ethernet 2' -NewName 'WuTangLan'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_NetAdapter..."3e77a8955741"):ROOT/StandardCimv2/MSFT_NetAdapter) [
Rename-NetAdapter], CimException
+ FullyQualifiedErrorId : HRESULT 0x800106d9,Rename-NetAdapter
Is there any way to rename the network adapter from within the container?
My search-mailbox command not work. the issue is like:
[PS] C:\Windows\system32>Search-Mailbox -Identity "abc" -SearchQuery "Subject:'test'"
Target mailbox or .pst file path is required.
+ CategoryInfo : InvalidArgument: (:) [], ArgumentException
+ FullyQualifiedErrorId : 78AF2AE3
At the same time, the command like get-mailbox has no problem.
Doese anybody can help?
The problem fixed by set target mailbox and folder. Use command like folloing:
Search-Mailbox -Identity "abc" -SearchQuery "Subject:'test mail'" -TargetMailbox "demo.xw" -TargetFolder "SearchLog"