So I have to add this registry entry using PowerShell and sadly it has a space and a / in it. I'd like to know what the syntax is for adding this kind of entry or a new method because I'm unable to find a good answer. To be clear this needs to create a key called RC4 128/128 under the ciphers folder.
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers" -Name RC4 128/128
This is the error I got below:
New-Item : A positional parameter cannot be found that accepts argument '128/128'.
At line:1 char:1
+ New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProvid ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand
It's not a Powershell issue, but it's an issue with the way the New-Item cmdlet is written.
Here's how you do it though:
([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $env:COMPUTERNAME)).CreateSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 128/128')
Credit: u/bhudlemeyer from reddit
It's very strange that they require you to create a key path with a space and slash because even regedit doesn't allow that.
Related
Troubleshooting i tried uninstalling nuget. NuGetProvider-2.8.5.208.dll to be specific.
I have never worked with Power Shell before and am totally lost.
I found this question that helped me find nuget and create a command to delete it.
But I'm unable to follow through.
I did start powershell as administrator.
Here the input:
(Get-PackageProvider|where-object{$_.name -eq "nuget"}).ProviderPath|Remove-Item -force Restart-Computer
The error message:
Remove-Item : The input object cannot be bound to any parameters of the command because the command does not accept pipeline input or the input and its properties do not match any of the parameters that accept pipeline input.
and its properties do not match any of the parameters that accept pipeline input.
line:1 character:70
+ ... _.name -eq "nuget"}).ProviderPath|Remove-Item -force Restart-Computer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (C:\Users\XXX ...GetProvider.dll:String) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.RemoveItemCommand
How can i solve this and successfully uninstall it?
Thanks for your answer!
Still no luck. Here the error:
Remove-Item : The element C:\Users\XXX\AppData\Local\PackageManagement\ProviderAssemblies\nuget\2.8.5.208
\Microsoft.PackageManagement.NuGetProvider.dll cannot be removed: Access to the path "C:\Users\XXX\AppData\Local\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvide
r.dll" denied.
Line:1 Character:44
+ (Get-PackageProvider NuGet).ProviderPath | Remove-Item -Force
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Users\XXX ...GetProvider.dll:FileInfo) [Remove-Item], Unauthoriz
edAccessException
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
I'm trying to create a share on a Folder with Powersherll but it just won't work and I don't know why. I'm trying to share it with this comand:
New-SmbShare -Name "$($Username) Share" -Path "$($StandardPath)$($Username)\home\" -ChangeAccess "Labor\$($Username)"
But I always get this error:
New-SmbShare : The system cannot find the file specified.
At C:\Users\ewzadmin\Desktop\AddADUsers.ps1:55 char:9
+ New-SmbShare -Name "$($Username) Share" -Path "$($StandardPat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare) [New-SmbShare], CimException
+ FullyQualifiedErrorId : Windows System Error 2,New-SmbShare
I don't understand why he is trying to share a File when I want to share a Folder...
Okay I did find the Problem in my Script. It was that I was already using a \\192.168.1.32\users\$username\ path to create the folder. But because I didn't have a share the folder was never created...
Im so dump
I thought I'd go this sorted out in this other question but I dont seem to be able to disable the Reset-BC command.
Normally I would use
Remove-Item -force alias:Reset-BC
However I just get the following error
Remove-Item : Cannot find path 'Alias:\Reset-BC' because it does not exist.
At line:1 char:1
+ Remove-Item -force alias:\Reset-BC
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Alias:\Reset-BC:String) [Remove-Item], ItemNot
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
Could anyone explain this or tell me how to get rid of it?
Definitely the thing that annoys me about powershell the most - it just litters your path with loads of rubbish. On occasion it also actually hides proper applications like where and sc with its stuff aswell which is even worse. I would use cmd but the lack of autocomplete is painful :(
You can test existance of Cmdlet:
If(get-item alias:Reset-BC) {Remove-Item -force alias:Reset-BC} else {'not exist'}
I'm having some trouble browsing a powershell I have created.
I have implemented the methods listed here
The documentation also says
Set-Location: This cmdlet sets the current working location to a specified location. You do >not need to overwrite any methods to support this cmdlet.
But I'm getting the error
cd : Provider operation stopped because the provider does not support this operation.
At line:1 char:1
+ cd banksia:\
+ ~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Set-Location], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.SetLocationCommand
What do I have to implement to make Set-Location work?
Did you derive from NavigationCmdletProvider? That is required to support Set-Location IIRC. It relies on the provided implementation of bool IsItemContainer(string path).
So 7z.exe is in my $PATH environment variable.
PS C:\Users\jimmeh> 7z.exe
Bad numeric constant: 7.
At line:1 char:2
+ 7 <<<< z.exe
+ CategoryInfo : ParserError: (7:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : BadNumericConstant
Besides renaming the EXE, is there a way to do this, or is it a bug in Powershell?
It work like
& '.\7z.exe'
if you want to specify an archive to extract
& '.\7z.exe' e your.zip
This is no longer a problem with Powershell 4.0
http://www.microsoft.com/en-us/download/details.aspx?id=40855