With each security update and version bump of Samba, winexe is becoming
more and more finicky, so I thought it time to see if Window's own ssh
could be used for the same purpose.  While it's not as straightforward
as I'd hoped, it does work and doesn't require anything other than the
binaries I'd already packaged for the purpose. This is the script executed with $Conf{DumpPreUserCmd}:
#!/bin/bash
# # Takes one parameter, the name of the system
#
BOX=$1
/usr/bin/ssh Administrator@$BOX
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Invoke-WmiMethod -Class Win32_Process -EnableAllPrivileges -Name Create
-ArgumentList \"cmd /c c:\backuppc\pre-exec.cmd\"'
# The above command is running in the background, we need to wait for
rsync
# to start
let i=0
while [ $i -le 72 ]; do
 PIDEXISTS=$(ssh Administrator@carrot 'dir C:\BackupPC\rsyncd.pid' |&
grep -v "^ Volume" | grep -v "^ Directory" | grep -o rsyncd.pid) if [ "$PIDEXISTS" == "rsyncd.pid" ]; then
   i=-1
   break
 fi
 echo -n "."
 sleep 5
done

if [ $i -eq -1 ]; then
 echo ""
 echo "Rsync and shadow copy loaded"
 exit 0
else
 echo "Error loading rsync"
 exit 1
fi
This assumes that one has installed the ssh server that comes with
Windows, and set up key authentication.  Note that it's necessary to use
an account with Administrative privileges in order to have the requisite
permissions. $Conf{DumpPostUserCmd} is more straightforward:
#!/bin/bash
/usr/bin/ssh Administrator@$BOX 'cmd /c echo '1' > c:\backuppc\wake.up'
<&-
_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to