Preferred method of copying IM db for IM Anywhere?

Started by jch2103, April 08, 2018, 05:05:08 AM

Previous topic - Next topic

jch2103

Currently, I manually copy the IMatch database to a separate copy for use with IMatch anywhere. Is there a preferred way to automate this process when I close the IM database? Is there a current or future app method for doing this ('when db closes, do this...')?

My apologies if I've missed something in the documentation or prior Forum discussions.
John

Mario

Just start IMatch via a batch file or a PowerShell Script.
When IMatch closes your batch continues and you can just copy the database to wherever you want.
2 lines of code...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Funny - I was only able to get this to work on my system by using a 3rd party service tool.. Sysinternals free PSService64... the regular net commands and/or powershell exe/bat's did not stop/start the service for me ... and I played with it for weeks.

I have this working perfectly now with SyncBackPro with a "copy if different" (scheduled to run each day at 0420am) with a "run before" .bat file:

     C:\users\fuego\documents\Psservice64.exe stop "ImatchWebService"
     TIMEOUT 90

and a "run after" .bat file:

     C:\users\fuego\documents\Psservice64.exe start "ImatchWebService"


Easy to setup and works without a hitch!  Enjoy....


Mario

The OP did not say anything about stopping a service.

Note: When you deal with services, always consider that there might be a wait time and you may have to do some polling ("Service still running....?").
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Yes - but as you know, you cannot just copy the IM database over to IMA if the IMA service is running (which for most folks I imagine is setup to start with Windows).. so, a batch script must include stopping the IMA service, waiting for it to register as stopped, then copying the DB and starting the service again... the only way I was able to get this to work on my system was using the above steps.

I think I had requested an automated way to have IM do this automatically at shutdown via an option.. but at the time you didn't want to include it.  As IM/IMA become more mature and connected products - perhaps this will be considered.

jch2103

Quote from: Jingo on April 09, 2018, 01:16:38 PM
I think I had requested an automated way to have IM do this automatically at shutdown via an option.. but at the time you didn't want to include it.  As IM/IMA become more mature and connected products - perhaps this will be considered.

I would support this; should it be a feature request?

In reference to my original question, I've set up a simple batch script to copy the DB for IMA, but as Jingo points out, a complete solution is more complicated than what a simple batch script can accomplish.
John

Mario

Stopping and Restarting a Service would require that IMatch demands Administrator privileges, and this opens a whole can of worms. I won't do this.

Options would be to write a separate app. But probably 10 users would need 15 different things from it.
In business and industrial environments such processes are usually automated and linked to backup processes, Vm or container setups etc. No real demand here.

For "private" users a shell script which takes the path of the database and the target folder and the credentials which are allowed to perform the operation would be doable. I'm just not sure that I need to be the one to write this...

Feel free to post a description of the application/PowerShell script/ you want me to write in the feature request board for IMA.
Python would be an option, but then everybody who needs it would need to install Python. Probably PowerShell is the way to go, or a dedicated Windows application which runs under an Amin account.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Ah... yes... administrator privileges... a wonderful addition to Windows that 99% of home users do not need... nor understand... thx Microsoft!   :o

Given that complexity ... I probably wouldn't bother putting too much thought/effort into this Mario.  To setup an automated approach is pretty straightforward and can be accomplished using freeware tools like the PSService and Syncback programs I use... I'm happy to post my .bat files for anyone that wants them along with the Syncback profile... with these 2 items - I've been backing up my IM DB to my IMA DB successfully and automatically for over 12 months now.

jch2103

Quote from: Jingo on April 09, 2018, 11:31:53 PM
I'm happy to post my .bat files for anyone that wants them along with the Syncback profile... with these 2 items - I've been backing up my IM DB to my IMA DB successfully and automatically for over 12 months now.

That would be helpful. Thanks!
John

Mario

#9
Quote from: Jingo on April 09, 2018, 11:31:53 PM
Ah... yes... administrator privileges... a wonderful addition to Windows that 99% of home users do not need... nor understand... thx Microsoft!   :o
You definitely don't want the normal user to be able to install software and start/stop services or to delete system files without warning and explicit permission.
Without the UAC every piece of malicious code could do whatever it wants on the system. The alternative is something like sudo on Linux, but that would be even more complicated for normal users.

Waiting for a service to stop (or start) is not complicated to do in Windows PowerShell:

http://www.powershellmagazine.com/2013/04/10/pstip-wait-for-a-service-to-reach-a-specified-status/

Some prefer to do a "while not stopped" loop, but the WaitForStatus method is easier and allows you to use a timeout.
Then do a file copy of the database file, and then call start the service again.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: Jingo on April 09, 2018, 11:31:53 PM
Ah... yes... administrator privileges... a wonderful addition to Windows that 99% of home users do not need... nor understand... thx Microsoft!   :o


I totally agree ... and I am one of these 99%. Silly made, from my point of view.
I sit alone bevore my own computer and has often (depends on the program) to click on a button (only click, nothing else!), simply to say "yes, I am the administrator".

If that could be prevented, I don't know how. So I completely agree with your sentence (99% of home users do not need... nor understand.)
Best wishes from Switzerland! :-)
Markus

Carlo Didier

Quote from: Jingo on April 09, 2018, 11:31:53 PM
Ah... yes... administrator privileges... a wonderful addition to Windows that 99% of home users do not need... nor understand... thx Microsoft!

WRONG! I've been dealing with "users" as a helpdesk operator and a system manager for nearly 30 years. Giving users administrator rights, even on their private PC at home is just calling for disaster. I can't count how many friends' PCs I had to repair the OS, rebuild or disinfect because they had admin priviledges and did all sorts of stupid things.
I would say 99% (at least) of home users must simply be protected against themselves  :)

I don't even have admin privileges on my work PC (although I have administrative accounts with which I could do essentially anything) because I don't need them. I only use my privileged accounts when I really need to do something that requires those privileges and then I know exactly what I'm doing.

Carlo Didier

Quote from: sinus on April 10, 2018, 08:26:20 AMI totally agree ... and I am one of these 99%. Silly made, from my point of view.
I sit alone bevore my own computer and has often (depends on the program) to click on a button (only click, nothing else!), simply to say "yes, I am the administrator".

If your PC were correctly setup with a seperate admin account and a seperate normal user account, both with (different!) passwords, it would not be sufficient to click "yes" (which could be automated by a malware), but you would need to type in the admin account password before anything could happen. That's the way to do it.

Lots of malware nowadays don't even require you to consciously click on something. If you are not an administrator, malware can do much less harm.

Jingo

Quote from: Carlo Didier on April 10, 2018, 10:16:52 AM
Quote from: Jingo on April 09, 2018, 11:31:53 PM
Ah... yes... administrator privileges... a wonderful addition to Windows that 99% of home users do not need... nor understand... thx Microsoft!

WRONG! I've been dealing with "users" as a helpdesk operator and a system manager for nearly 30 years. Giving users administrator rights, even on their private PC at home is just calling for disaster. I can't count how many friends' PCs I had to repair the OS, rebuild or disinfect because they had admin priviledges and did all sorts of stupid things.
I would say 99% (at least) of home users must simply be protected against themselves  :)

I don't even have admin privileges on my work PC (although I have administrative accounts with which I could do essentially anything) because I don't need them. I only use my privileged accounts when I really need to do something that requires those privileges and then I know exactly what I'm doing.

Well... that may be... but there should be a more global setting that turns off the entire UAC/LUA for POWER USERS/ADMINS that wish to do so.  As it is now, there are multitudes of settings that need to be tweaked and I STILL get "admin required" messages when doing simple things like trying to delete a folder under C:\program files...  If I am setup as an ADMIN user... I don't want ANY restrictions... in that case, my software can do what it wants to my system and I don't need to worry about privileges.

Jingo

Quote from: jch2103 on April 10, 2018, 12:31:24 AM
Quote from: Jingo on April 09, 2018, 11:31:53 PM
I'm happy to post my .bat files for anyone that wants them along with the Syncback profile... with these 2 items - I've been backing up my IM DB to my IMA DB successfully and automatically for over 12 months now.

That would be helpful. Thanks!

Here they are John... I've attached them here - let me know if you run into issues...

The .bat files and PSservice.exe programs can be placed anywhere together... the .sps file is for syncbackPro if you choose to use it to automate the process... you will obviously need to modify the profile to point to your own location of IMA and IM databases as well as the user name for the system.  Also, you'll need to change the before/after settings to point to the location of the .bat files. 

Good luck!

sinus

Quote from: Carlo Didier on April 10, 2018, 10:20:59 AM
Quote from: sinus on April 10, 2018, 08:26:20 AMI totally agree ... and I am one of these 99%. Silly made, from my point of view.
I sit alone bevore my own computer and has often (depends on the program) to click on a button (only click, nothing else!), simply to say "yes, I am the administrator".

If your PC were correctly setup with a seperate admin account and a seperate normal user account, both with (different!) passwords, it would not be sufficient to click "yes" (which could be automated by a malware), but you would need to type in the admin account password before anything could happen. That's the way to do it.

Lots of malware nowadays don't even require you to consciously click on something. If you are not an administrator, malware can do much less harm.

I think, a lot of users does buy a computer and use this computer alone, no one else uses the computer.
Why for heaven's sake I must setup as admin AND a separate user account? I am the only one, who uses this computer! For me this is nonsense.

In a company with several people of course this is a completely other thing.
Best wishes from Switzerland! :-)
Markus

Mario

QuoteWhy for heaven's sake I must setup as admin AND a separate user account? I am the only one, who uses this computer! For me this is nonsense.

This was typical on XP or Windows 7. Since it is dangerous to always work with Admin privileges, users were encouraged to use a "normal" user account for daily work, and only switch to the Admin account (Run as...) when they do some work that require Admin privileges. Less danger to damage the system by accident or to infect it with something.

Windows 8..10 introduced the UAC technology, where Windows displays an extra prompt when you try to do something that requires Admin privileges. If your user is member of the Admin group (default) you only need to acknowledge. This is a barrier, telling you that the operation you are attempting to perform can potentially damage your system. And if this "This operation requires Admin privileges..." turns up out of the blue, you know that something is fishy or that some thing you just started (or downloaded) is trying to comprise your system.

A good trade-off between usability and security. You can even control how often (for which operations) you get the UAC.
And if your user account is not in the Admin role, you will have to input the name of an admin user and the password explicitly. Even more secure, but pretty much a nuisance for everyday use.

In corporate environments only selected users get "local" admin privileges (on their PC) and even then access is restricted by group polices and similar tools. Otherwise it would be Admins nightmare  :o
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: Mario on April 10, 2018, 01:43:27 PM
QuoteWhy for heaven's sake I must setup as admin AND a separate user account? I am the only one, who uses this computer! For me this is nonsense.

This was typical on XP or Windows 7. Since it is dangerous to always work with Admin privileges, users were encouraged to use a "normal" user account for daily work, and only switch to the Admin account (Run as...) when they do some work that require Admin privileges. Less danger to damage the system by accident or to infect it with something.

Windows 8..10 introduced the UAC technology, where Windows displays an extra prompt when you try to do something that requires Admin privileges. If your user is member of the Admin group (default) you only need to acknowledge. This is a barrier, telling you that the operation you are attempting to perform can potentially damage your system. And if this "This operation requires Admin privileges..." turns up out of the blue, you know that something is fishy or that some thing you just started (or downloaded) is trying to comprise your system.

A good trade-off between usability and security. You can even control how often (for which operations) you get the UAC.
And if your user account is not in the Admin role, you will have to input the name of an admin user and the password explicitly. Even more secure, but pretty much a nuisance for everyday use.

In corporate environments only selected users get "local" admin privileges (on their PC) and even then access is restricted by group polices and similar tools. Otherwise it would be Admins nightmare  :o

Perhaps I'm just getting old.... and I do totally get the whole security thing.. but.. there should be an easy way to turn off all the restrictions and items for an ADMIN user on a local/home PC.  As Markus said... I am the only one that uses my home PC... and I know what I'm doing.  I don't want/need windows to restrict my actions nor do I want to have to explicitly elevate permissions or "run as adminstrator"... I AM THE ADMIN... let me do what I want... (there is a reason why XP was the best OS MS created... it was simple and easy to use). 

Mario

#18
The problem is that, when you are the Admin and you always work with full Admin privileges, some malicious piece of software, a fly-by script on a web page that abuses a browser security hole or a villainous email attachment that gets somehow executed under your account has full access to everything on your system. And it takes 0.1 seconds to install a trojan, logger or ransomware... All these attempts are futile if you are not working with Admin rights all the time.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook