Link to home
Start Free TrialLog in
Avatar of KimiRai23
KimiRai23

asked on

Access CIFS share with powershell core on Ubuntu

Hello,

I want to have access to a Windows share with Powershell Core on a Ubuntu system.

So I tried this :
$cred = Get-Credential -UserName 'domain\user'
remove-item -path //192.168.1.200/FTP/test/test.txt -Credential $cred

Open in new window


I have an error :
Remove-Item : Cannot retrieve the dynamic parameters for the cmdlet. The FileSystem provider supports credentials only on the New-PSDrive cmdlet. Perform the operation again without specifying credentials.

Open in new window


Anyone can help me please ?

Thank you
Avatar of Michelangelo
Michelangelo
Flag of Italy image

As per documentation, credential parameter does not work
"This parameter is not supported by any providers installed with PowerShell."
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-item?view=powershell-6
Avatar of KimiRai23
KimiRai23

ASKER

Same error :

remove-item -path //192.168.80.200/FTP/Prod/test/test.txt
remove-item : Cannot find path '//192.168.80.200/FTP/Prod/test/test.txt' because it does not exist.
Exit powershell core and try accessing the same file via bash. It will succeed only if the share is mounted.

That error is saying the path does not exist. I suppose you have not mounted the path beforehand.

You have to access the share first, then it becomes available to powershell core. Powershell core does not offer a SMB/CIFS implementation di per sè.

Mount the share via the underlying operating system.
Yes I know I can mount the volume via NFS but this is not my goal. I want to use powershell core on Ubuntu to access via CIFS the share with credentials.
How do you know this is not possible ? Do you have a web page on it ?
Thanks
NFS is not CIFS.

Powershell is a shell such as bash and others. The fact Microsoft built does not mean it integrates samba/CIFS capabilities.
Network protocols are implemented outside shells.
There is no page which lists which are not implemented - how could it be? You won’t find a page which explicitly says that with powershell core you cannot build RAIDs, for instance. Some things are implemented at OS level or user level, you won’t find them redone in a shell.
ASKER CERTIFIED SOLUTION
Avatar of Michelangelo
Michelangelo
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you
Glad I was of help