Remove Git Hub related files - github-for-windows

I am learning Git Hub. So I am a newbie.
Trying to remove git related files in project directory. I used this line:
rd .git /S/Q
However it gives me this error when I use VS Code:
Remove-Item : A positional parameter cannot be found that accepts argument '/q'.
At line:1 char:1
+ rd /s /q .git
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
and when I use CMD - command promt it gives me this error:
.git\refs\remotes - The directory is not empty.
What is going on.
This is where I get my information about this:
From stackoverflow
From YouTube
I am using Windows 10 btw.
EDIT:
I tried:
rd /S /Q .git
and I get error:
Remove-Item : A positional parameter cannot be found that accepts argument '/Q'.
At line:1 char:1
+ rd /S /Q .git
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
Tried:
rd /S/Q .git
Error:
Remove-Item : A positional parameter cannot be found that accepts argument '.git'.
At line:1 char:1
+ rd /S/Q .git
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
However I tried in command promt:
rd /S /Q .git
And I get :
.git\refs\remotes - The directory is not empty.
I try it second time right after that and it works...
So what am I missing here?
EDIT 2:
All of these comands work in command promt but only if I type them for the second time. Including the command - rd .git /S/Q.
The first time I get :
.git\refs\remotes - The directory is not empty.
and if I type it for the second time it works.
In VS Code it is not working no matter how many times I type them.

Related

PowerShell PackageManagement - How to uninstall a package provider?

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

Installing CCM client on PC via powershell

I'm trying to speed up how soon SCCM recognises a device on the domain and starts the process of installing applications.
I have the below in powershell
$CCMInstallerPath = "\\ServerFQDN\SMS_MAN\Client\ccmsetup.exe"
$args = "/mp:MPServer", "/LOGON", "/UsePKICert", "SMSSLP=SMSSLPServer", "SMSSITECODE=MAN"
& $CCMInstallerPath $args
I get the below error:
Program 'ccmsetup.exe' failed to run: Access is deniedAt line:1 char:5
+ & $CCMInstallerPath $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:5
+ & $CCMInstallerPath $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
I have read and execute access to this file, both by group and directly by name
I have also tried:
Start-Process -FilePath \\ServerFQDN\SMS_MAN\Client\ccmsetup.exe -ArgumentList "/mp:MPServer", "/logon SMSSITECODE-MAN", "/UsePKICert"
and get the error
Start-Process : This command cannot be run due to the error: Access is denied.
At line:1 char:5
+ Start-Process -FilePath \\ServerFQDN\SMS_MAN\Client\c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
ServerFQDN is a replacement for one of our NM servers
I can fully connect to the folder and run the exe manually
I am running elevated powershell
Issue was caused by incorrect share permissions found in effective access.
Permission was granted to run the file but effective access was showing differences

Running MongoDB, not recognizing mongod.exe or mongo.exe

I have been running MongoDB fine on my system, ran it 2 days ago. Now I am not able to access my file folders at all. When I type DIR, I see the files but when I try to access them through command line I get ObjectNotFound.
PS C:\Program Files\MongoDB\Server\4.2\bin> cd ./mongo.exe
cd : Cannot find path './mongo.exe' because it does not exist.
At line:1 char:1
+ cd ./mongo.exe
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./mongo.exe:String) [Set-
Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Chocolatey doesn't install

Following the steps to install Chocolatey via Powershell doesn't work on my Windows 7 64bit PC. I'm following https://chocolatey.org/install#install-from-powershell-v3
I have confirmed the ExecutionPolicy and that system path has
Powershell;
PS C:\Users\a> Get-ExecutionPolicy
AllSigned
PS C:\Users\a> ($env:Path).split(';')
%SystemRoot%\system32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\ProgramData\Oracle\Java\javapath
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\Java\jre1.8.0_40\bin
C:\Program Files\Java\jdk1.8.0_40\bin
C:\Program Files (x86)\AMD\ATI.ACE\Core-Static
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\HashiCorp\Vagrant\bin
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Skype\Phone\
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\libexec\git-core
C:\Program Files (x86)\Nmap
C:\Program Files\smartmontools\bin
Here are my error messages;
PS C:\Users\a> iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
???# : The term '???#' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ???# =====================================================================
+ ~~~~
+ CategoryInfo : ObjectNotFound: (???#:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.5.
!Test-Path : The term '!Test-Path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:188 char:11
+ } elseif (!Test-Path $7zaExe) {
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (!Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Extracting C:\Users\a\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\a\AppData\Local\Temp\chocolatey\chocInstall...
Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
At line:211 char:3
+ $process.Start() | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
Exception calling "BeginOutputReadLine" with "0" argument(s): "StandardOut has not been redirected or the process hasn't started yet."
At line:212 char:3
+ $process.BeginOutputReadLine()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
At line:213 char:3
+ $process.WaitForExit()
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install again. Error: 7-Zip signalled an unknown error (code )
At line:225 char:15
+ default { throw "$errorMessage 7-Zip signalled an unknown error (code $exitC ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to unzip...n error (code ):String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install again. Error: 7-Zip signalled an unknown error (code )
I have tried the error messages suggestion on the last line
Perhaps try setting $env:chocolateyUseWindowsCompression = 'true'
But that only results in a whole series of other errors
PS C:\admin\scripts> iwr https://chocolatey.org/install.ps1 -UseBasicParsing
StatusCode : 200
StatusDescription : OK
Content : # =====================================================================
...
You're downloading a UTF-8-encoded file (the content begins with the characteristic UTF-8 byte order mark ), but it's being treated as ASCII text.
Besides:
I'm following https://chocolatey.org/install#install-from-powershell-v3.
No, you're not. The website you referenced tells you to use
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
which works as advertised, whereas you're trying to use
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
If you want to use that approach you need to remove the BOM from the content before piping it into Invoke-Expression:
(iwr https://chocolatey.org/install.ps1 -UseBasicParsing).Content -replace '^' | iex

Merge 3 partial files with PowerShell Copy

I have 3 partial files that I need to merge to just 1 zip.
When using this PowerShell script:
copy /b v9_setup.1 + v9_setup.2 + v9_setup.3 v9_setup.zip
I get this error:
Copy-Item : A positional parameter cannot be found that accepts argument
'v9_setup.2'.
At line:1 char:1
+ copy /b v9_setup.1 v9_setup.2 v9_setup.3 v9_setup.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Copy-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
I am using Windows 10 Pro.
As LotPings and user1287678 says, running the script in cmd.exe works. Thanks.