"rm: cannot remove 'wslServer.sh': No such file or directory" - visual-studio-code

In my ongoing war with WSL2/VSCODE I'm trying to completely remove the .vscode-insiders directory from my machine.
rm -rf wont work, neither will delete from windows. Anyone know How I can destroy this thing?
I'm trying to get a dev environment set up with WSL2 VS CODE and Docker in Windows 10 insiders (18965).
I ran into problems trying to install the remote development pack, specifically the /ms-vscode-remote.remote-wsl-0.39.4 extension which is causing no end of problems.
However When I try to remove all vs code-insiders residue I get permissions problems with:
:/mnt/c/Users/micro/.vscode-insiders/extensions/ms-vscode-remote.remote-wsl-0.39.4/scripts/wslServer.sh
I cant delete it from the Ubuntu side with rm -rf
cannot remove 'wslServer.sh': No such file or directory
I cant delete it from windows explorer - no permissions
I cant delete it from powershell as admin running Remove-item.
Looked at all the existing answers on stack and none have a solution as far as i can see.
Would love some help?
Remove-Item : Access is denied
At line:1 char:1
+ Remove-Item wslServer.sh
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Users\micro...ts\wslServer.sh:String) [Remove-Item], Unauthorized
AccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand
Remove-Item : Cannot find path
'C:\Users\micro.vscode-insiders\extensions\ms-vscode-remote.remote-wsl-0.39.4\scripts\wslServer.sh' because it does
not exist.
At line:1 char:1
+ Remove-Item wslServer.sh
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\micro...ts\wslServer.sh:String) [Remove-Item], ItemNotFoundEx
ception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

Ctrl+alt+delete - right click 'Windows Subsystem For Linux' - end task.
Now try deleting the folder or let VScode do it for you.

Related

CLI Reset Local Cluster (Rebuild Clusters according to Manifest)

I'm trying to figure out the command to rebuild clusters according to the manifest, ie. the equivalent to the tray icon menu entry: Reset Local Cluster.
I run the command I've found as a user who is a member of the Local Administrators, but I get some No Access (Ingen tilgang)
PS C:\Users\caec> C:\"Program Files"\"Microsoft SDKs"\"Service Fabric"\ClusterSetup\DevClusterSetup.ps1 -PathToClusterDataRoot c:\SfDevCluster\data -PathToClusterLogRoot c:\SfDevCluster\log -auto
Removing cluster configuration...
Opening TraceWriter FabricDeployer, path c:\SfDevCluster\log\Traces\FabricDeployer-638106697980303321.trace
Closing TraceWriter FabricDeployer, path c:\SfDevCluster\log\Traces\FabricDeployer-638106697980303321.trace
Cleaning existing certificates...
Certificates removed.
Stopping all logman sessions...
Cleaning log and data folder...
c:\SfDevCluster\data\_App\_Node_1\INFODO~1.API\INFODO~1.0\mscordbi.dll - Ingen tilgang.
c:\SfDevCluster\data\_App\_Node_3\INFODO~1.API\INFODO~1.0\mscordbi.dll - Ingen tilgang.
Using Cluster Data Root: c:\SfDevCluster\data
Using Cluster Log Root: c:\SfDevCluster\log
c:\SfDevCluster\data\_App\_Node_1\INFODO~1.API\INFODO~1.0\mscordbi.dll - Ingen tilgang.
c:\SfDevCluster\data\_App\_Node_3\INFODO~1.API\INFODO~1.0\mscordbi.dll - Ingen tilgang.
EnsureDirectoryCleaned : Cannot clean up c:\SfDevCluster\data fully as references are likely being held to items in it. Please remove those and retr
y.
At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:525 char:5
+ EnsureDirectoryCleaned $clusterDataRoot
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,EnsureDirectoryCleaned
WARNING: Hints: Is some other process holding on to references?
ScriptHalted
Stop-Transcript : An error occurred stopping transcription: The host is not currently transcribing.
At C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\DevClusterSetup.ps1:54 char:5
+ Stop-Transcript
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Stop-Transcript], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.StopTranscriptCommand
I had a devenv process running, so it had a lock on some files;)

In Powershell, how do I delete a file with a hyphen (dash) in the filename?

In Powershell, when I try to delete a file with a hyphen in the nam like this:
remove-item 'C:\S3\op_netadmin-47.bak'
I get this error:
remove-item : Cannot remove item C:\S3\op_netadmin-47.bak: Access to the path 'C:\S3\op_netadmin-47.bak' is denied.
At line:1 char:1
+ remove-item 'C:\S3\op_netadmin-47.bak'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\S3\op_netadmin-47.bak:FileInfo) [Remove-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
But if I rename the file to op_netadmin_47.bak, it works fine.
I've tried with and without double quotes as well as single quotes
I tried your file name with - and _, both work ok. I also tried to use " around file name which also works.
As #mklement0 mentioned in comments read-only files require -Force parameter
Make sure user running script has read/write access to given folder

Publish-Module fails with NuGet.Build.Tasks.Pack.targets(198,5) error : Index was outside the bounds of the array

I've upgraded to dotnet sdk version 3.1 and am trying to publish my powershell module. I am using powershell 5.1.
I run the command:
Publish-Module -Path "C:\sources\myModules\InstallationUtils\" -NuGetApiKey "xxxxxxx" -Repository internal.packages.org"
and get the error:
[C:\Users\xxxxxx\AppData\Local\Temp\469d7c83-6e1a-4366-b948-6a415b0279be\Temp.csproj]
Successfully created package
'C:\Users\xxxxxx\AppData\Local\Temp\158464074\myModules\InstallationUtils\InstallationUtils.1.4.8.nupkg'.
C:\Program Files\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error :
Index was outside the bounds of the array.
[C:\Users\xxxxxx\AppData\Local\Temp\469d7c83-6e1a-4366-b948-6a415b0279be\Temp.csproj]
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:10944 char:17
+ ... Publish-PSArtifactUtility #PublishPSArtifactUtility_Param ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility
Is anyone have similar issues and managed to fix it?
thanks
I have a work around, which involves replacing the old version of version nuget.exe in
C:\Users\xxxxx\AppData\Local\Microsoft\Windows\PowerShell\PowerShellGet\
with the latest version of nuget.exe .
I found the work around on SQLDBAWithABeard but I am hoping that there is a better solution than this?

Trouble installing Powercli 11.x

Easing back into Windows after a 3-4 year MacOS hiatus. Powershell has come a long way but I am running into some errors I can't figure out here.
Every article I see on installing the newer PowerCLI is rather simple. Use a package manager to download/install it and off you run. Not for me, I'm getting the following error when trying to run Install-Module -Name VMware.PowerCLI:
PackageManagement\Install-Package : Unable to find dependent module(s) (VMware.VimAutomation.Cis.Core)
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:9307 char:21
+ ... $null = PackageManagement\Install-Package #PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (VMware.VimAutomation.Cis.Core:String) [Install-Package], Exception
+ FullyQualifiedErrorId : UnableToFindDependencyPackage,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
I have tried this on two Windows machines and even with Powershell Core on a Mac. Same issue every time. What am I missing and/or doing wrong?

[Get-Content], ItemNotFoundException : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand in VSTS PowerShell task

Am working on ARM Templates Deployment using powershell Command line
$manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
which is going to be find and run the .json file .It is running fine in my local PC. But when am running the same line through VSTS PowerShell task, then am receiving following issue:
At C:\XX_work\r7\a\CIBuild\drop\XX\XX\Deployment\Manif
estAzureDeployment.ps1:191 char:21
+ $manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\XX...a\manifest.json:String) [Get-Content], ItemNotFoundEx
ception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
So, please give me suitable suggestions for this issue
Using absolute path through built-in release variable instead.
For example, System.DefaultWorkingDirectory ($(System.DefaultWorkingDirectory)): The directory to which artifacts are downloaded during deployment of a release. The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent. Same as Agent.ReleaseDirectory and System.ArtifactsDirectory.