1

Background: I have an ubuntu machine that hosts a couple applications that I am in charge of and I want to automate the backup of the database that powers these applications. I noticed that PowerShell is now cross platform, so I figured a simple script to run mysql dump and then move the dump file to a different server would fill my needs exactly.

Unfortunately, I seem to be stuck at mounting a temporary PS drive.

I did a ping test so the two servers can communicate with each other, however the log on credentials for the ubuntu machine is different than what the windows host would expect. in the below setup I double checked username and password, they are correct.

$user = "domain\username"
$pass = ConvertTo-SecureString -String "my password"  -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user, $pass
New-PSDrive -Name "SQL Backups" -PSProvider "FileSystem" -Root "\\server\folder" -Credential $cred

error response:New-PSDrive: The specified drive root "\\server\folder" either does not exist, or it is not a folder

I know the folder/path exists as I can pull it up on a windows machine through file explorer.

Should/is it possible to move a file from an Ubuntu host to a Windows host with PowerShell core installed on the former? Or am I going down a rabbit hole?

PSVersion: 7.2.1

PSEdition: Core

  • Can the Linux machine resolve the Windows server's name? Can you connect to the shared folder from the Linux machine using some other tool than PowerShell? – Massimo Jan 26 '22 at 18:51
  • @Massimo I am not exactly sure how to test that. I did do a ping from the Linux machine to windows machine using the windows FQDN and got results. If you have another way to test that without any 3rd party tool or package I would be willing to give it a try. – Jeffrey Quinn Jan 26 '22 at 19:00
  • https://unix.stackexchange.com/questions/99065/how-to-mount-a-windows-samba-windows-share-under-linux – Massimo Jan 26 '22 at 19:33

0 Answers0