Configure a GCP Filestore on a GCP Windows Instance - google-cloud-filestore

I've been trying to mount the Google Filestore and use as a NFS Shared volume on two of my GCP Windows VM instances but I keep getting the error below. Any assistance is much appreciated. I need to figure this one out.
PS C:\Windows\system32> mount 10.*.***.250:/logs_arcon D:\Storage
cmdlet New-PSDrive at command pipeline position 1
Supply values for the following parameters:
Root: D:\
mount : Cannot find a provider with the name 'D:\Storage'.
At line:1 char:1
+ mount 10.42.144.250:/logs_arcon D:\Storage
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\Storage:String) [New-PSDrive], ProviderNotFoundException
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand

The format of your command mount 10.42.144.250:/logs_arcon D:\Storage doesn't look to be aligned with the provided in the documentation examples.
The format shown in the docs should work:
mount 10.0.0.2:/vol1 z:

Related

Problems using "RunAs" in powershell

I am trying to access powershell from another user (user2), but at the same time I also want to access the resources of my main user (user1), I have a virtual environment, windows server 2022 and a windows 10 pro machine, in which I am doing the following:
Right click on the powershell icon > Run as another user, then I access user 2 to which I want to connect with their respective credentials.
Once this is done in powershell I execute the following:
runas /user:corp\user2 /netonly powershell
Then, I put the credentials again and navigate to the path of my main user(user1) and when I execute "ls", it gives me the following error:
ls : Access denied to path 'C:\Users\user1'.
At line:1 char:14
+ ls
+ ~~
+ CategoryInfo : PermissionDenied: (C:\Users\user1:String) [Get-ChildItem], UnauthorizedAccessExcepti
on
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand

CMD.exe and Powershell.exe cannot generate ssh keys using ssh-keygen

Hope you can help me out here. I've been playing around with some SSH authentication. I have no idea why this is happening, but now when I run a simple ssh-keygen command I get a response saying Access is denied. in addition to a pop-up that reads "This app can't run on your PC. To find a version for your PC, check with the software publisher".
I then tried running the ssh-keygen command in Powershell (as admin and as regular user) and got the following:
Program 'ssh-keygen.exe' failed to run: The specified executable is not a valid application for this OS platform.At
line:1 char:1
+ ssh-keygen
+ ~~~~~~~~~~.
At line:1 char:1
+ ssh-keygen
+ ~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
However, using ssh -V shows that it is installed:
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
I can still SSH fine into other devices, if that's of any relevant.
Any help would be very much appreciated here!

Docker for windows: Bind mounting an Azure SMB drive fail

I spent days on this issue, can't figure out how it's done?
Mounting the drive letter from Azure file share works fine using
New-PSDrive -Name T -PSProvider FileSystem -Root "\\xxxx.file.core.windows.net\share" -Scope Global -Persist
The drive can be accessed in both PowerShell and in explorer, even after windows reboot.
But when trying to mount that in a container fail to say the path does not exist.
docker run -d --name webserver1 -v T:\:c:\share -p 80:80 microsoft/iis
Error response from daemon: invalid volume specification: 'T:\:c:\share': invalid mount config for type "bind": bind source path does not exist: t:\.
I also tried to add the SMB drive via
New-SmbGlobalMapping -RemotePath "\\xxxx.file.core.windows.net\share" -Credential $credentialObject -LocalPath T: -FullAccess #( "NT AUTHORITY\SYSTEM", "NT AUTHORITY\NetworkService" ) -Persistent $true -RequirePrivacy $true
Then I can bind mount T: but get "access was denied" instead when trying to check c:\share inside the container. What am I doing wrong? Also referring to this: https://github.com/moby/moby/issues/37863
If there is another way to mount the SMB share directly into the container without first mounting it in windows, that would be fine too. I solved it with Linux but doesn't seem to be possible in windows.

How to correctly create Virtual Switch in Windows Server 2016 TP4 while installing Docker? (not boot2docker)

I have an installed Windows Server 2016 Technical Preview 4 on VMware
Warkstation.
It has 2 GB RAM and 60 GB disk space.
I try to install Windows Server Host for Docker according to official Microsoft instruction.
Instruction in general in the picture
I don't need a Hyper-V Containers technology so for this guide i don't have to make steps marked with a one asterisk '*'
So we have six steps that we have to do for install Windows Server Host and Docker:
Install the Container Feature
Create Virtual Switch
Configure NAT
Configure MAC Address Spoofing
Install Container OS Images
Install Docker **
I have a problem in step two: Creat Virtual Switch while typing next cmdlet in PowerShell:
PS C:\> New-VMSwitch -Name "Virtual Switch" -SwitchType NAT -NATSubnetAddress 172.16.0.0/12
New-VMSwitch : Failed while adding virtual Ethernet switch connections.
Internal miniport create failed, name = '8A407781-1BF5-4BB0-8538-35CFF056C598', friendly name = 'vEthernet (Virtual Switch)', MAC = 'DYNAMIC': One or more arguments are invalid
(0x80070057).
At line:1 char:1
+ New-VMSwitch -Name "Virtual Switch" -SwitchType NAT -NATSubnetAddress ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-VMSwitch], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.NewVMSwitch
What should I do in this case?
I was able to install docker using Microsoft guide about auto-install instead of using manual guide:
# Auto-install instruction.
PS C:\> powershell.exe
PS C:\> start-process powershell -Verb runas
PS C:\> wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1
PS C:\> C:\Install-ContainerHost.ps1 -HyperV
# Wrong!
But there is an error in the last line in key -HyperV.
We need to ingore it, so the last line looks like:
PS C:\> powershell.exe
PS C:\> start-process powershell -Verb runas
PS C:\> wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1
PS C:\> C:\Install-ContainerHost.ps1
# Currect!
Using correct instruction i was able to install docker.
I had the same error on a Nano Server the first time I ran:
PS C:\> New-VMSwitch -Name "Virtual Switch" -SwitchType NAT -NATSubnetAddress 172.16.0.0/12
SwitchType NAT is definitely correct because the command doesn't accept the NATSubnetAddress parameter for anything other then a NAT switchtype.
Run it a second time and then it worked on my Nano Server.

Varying permissions on Windows Server based on method of authenticating

I'm running into a weird issue here.
I have a Windows server setup to allow SSH access via Cygwin.
The idea behind this is to allow me to remotely execute Powershell commands from one of my Linux boxes. Now, in the hopes of being secure while still allowing for automation, I did your typical ssh-copy-id to my designated account on that box. I then tried logging in via SSH keys... success! Now here's the weird part. I run my Powershell command:
powershell 'C:/cygwin64/scripts/add_email_address_to_distribution_list.ps1'
And get the following error message:
$ powershell
'C:/cygwin64/scripts/add_email_address_to_distribution_list.ps1'
Add-DistributionGroupMember : Value cannot be null. Parameter name:
serverSettings At
C:\cygwin64\scripts\add_email_address_to_distribution_list.ps1:2
char:28
+ Add-DistributionGroupMember <<<< -Identity some_distribution_list -Member user# domain.com
+ CategoryInfo : NotSpecified: (:) [Add-DistributionGroupMember],
ArgumentNullException
+ FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Exchange.
Management.RecipientTasks.AddDistributionGroupMember
Now if I remove the pubkey from my account's .authorized_keys file, login with my usual password, and retry... the script works!
I'm stumped as to why authentication via password over SSH allows for the script to run successfully , while authentication via keys over SSH doesn't.
Any ideas?
EDIT:
Here's the script that's being run:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
Add-DistributionGroupMember -Identity some_distribution_list -Member user#domain.com

Resources