How to find out local and remote time difference? - windows

I face strange situation: I suspect some of Windows PCs in the network are suddenly become out-of-sync with our NTP servers. So I need something I can remotely check time difference between Windows machine and NTP server. What can be the best is to log that difference so I will be able to graph it and see the moment it happens to debug further.
And, of course, I'd prefer remote tool that I'll run on some extra PC so I won't install anything on each of client PCs around network.
I also find out that some of clients are happy to sync with unix-based NTP server and won't sync with Windows-based (DC), while some other 'like' Windows-based NTP server. Something strange, indeed, but the network is legacy and I can suspect pretty everything.

Cygwin runs nicely on Windows, and you can use "ntpdate -q" to find the date on the remote server and "date" to get the machine on the local server. A short shell script later and you should be done -- you can then automatically capture the time difference.

Related

UIAutomation won't work in Windows Server (VPS) if I am not connected via RDP

I have script which uses mircrosoft's UIAutomation to automate an application. The script is inside a VPS running Windows Server 2012. The script works perfectly while I am connected to the VPS via Remote Desktop (RDP).
When I am not connected, the script seems to be stuck on SetFocus for a object... which leads me to believe that the script needs a Display/Screen/Session in order to work... but I am not sure if it is possible to do it while I am not connected to the VPS.
I can see 2 possible solutions here, either modify the script in someway to work in this environment or make the VPS have a virtual desktop while I am not connected (this solution might be more related to Server Fault rather than StackOverflow).
I am very confused, thanks for the help in advance :)
I managed to workaround the issue by actually connecting to the server to itself (to 127.0.0.1) via RDP so that it will always have an active RDP session for the automation script to run.
I am not happy with the results but it works... I cannot give clear instructions on how you would need to modify the settings in Windows to allow RDP connections from self, it was a one big trial and error process, I have to modify some policies in the Group Policy Editor and then some stuff that I don't remember.
There is another downside to this, a Windows server will allow 2 simultaneous connections to it but by using this method we are reserving a slot so only 1 connection at a given time is possible, something to be aware of.

Ansible - Managing Windows 2003 and WinRM connection timeout

I'm trying to implement Ansible in our company.
I have 2 huge problems that may cause us to leave this product, but before we give up I thought maybe someone could help us.
Some overall information - We installed ansible 2.1 on RHEL 6.5. We tried to use Ansible Tower but we gave up because of the complexity (most of our use is for ad-hoc commands).
The first issue is managing Windows server 2003. When we want to manage windows servers, we need to run the pre-script, but it only works with PowerShell v.3 and above, while Windows server 2003 is not supporting PowerShell v.3 (it's almost impossible to install this version).
In our company (unfortunately) there still dozens of Windows server 2003 machines.
Is there a way to make Ansible being able to manage those servers?
The second issue is the timeout of the WinRM. When we running an ad-hoc command on windows servers, there are machines that Ansible succeed to make a WinRM connection, but its hang out waiting the command to run (for example, even simple "hostname" commands).
We reduced the ansible timeout, but it's still hang out, so we assuming that it succeed making the WinRM connection but hang after.
There ia a way to configure the time out of ALL the process of ansible per machine, or otherwise configure the WinRM to have timeout after the connection succeeded?
Thanks,
Afik
Basically, no- due to major shortcomings of Powershell 2 for things we need to do, and the incredibly low number of Server 2003 installs left out there, we made PS3 the minimum required version.
There's been a little bit of work done by community folks to make a PS2-friendly version of the WinRM connection plugin to at least get basic Ansible connectivity working there (so "raw" will work, and modules can be transferred/run), but pretty much all the existing modules rely on Powershell cmdlets that don't exist in PS2/S2003. So you'd be back to "raw" for everything, which isn't much more useful than Powershell remoting (other than being able to blast commands to multiple machines at a time). If you want to see that, it's at
https://github.com/elum/ansible and
https://github.com/elum/ansible-modules-core
but we're unlikely to accept this into the core product or support it in any way.

Modifying files on remote Ubuntu server from Windows PC

I am developing some Python programs that I'm running on a remote Ubuntu Linux server (hosted on Slicehost). I would like to work on the source in an IDE on my Windows Vista PC, and have all file modifications sent directly to the Linux box without my intervention (i.e. without having to manually SFTP the files each time I change them). What is the very easiest way I can do this?
WinSCP includes a basic remote file editor, though if you want to use a proper IDE for your development this won't be much help.
I'd suggest you run a version control system like subversion, which would allow you to write a post-commit hook to automatically rsync your code the server with each commit.
Use PuTTy and SFTPDrive.
PuTTy is an SSH client, and SFTPDrive ($39 USD) will allow you to mount your remote file system locally as a drive letter.
Install Samba and OpenVPN on the server, and OpenVPN on the client. Setup Samba to share the directory tree you're interested in, and access it over the VPN for security. Perhaps Vista has non-sucky WebDAV support by now, and you could use WebDAV over HTTPS, but it was always crap under XP.
Ben's suggestion of a local dev environment using a VM is also a winner.
You could install cygwin and then have rsync run on cron every minute.
Or you could use Netdrive to access the server via FTP like a local disk:
http://tech.xptechsupport.com/netdrive-turn-your-ftp-into-a-drive-letter.html
Or you may be able to achieve something similar using cygwin and FUSE - you can on linux, but never tried it on cygwin.
Also, would it not be easier to set up a full dev environment locally? Maybe using a virtual machine? It'll be much quicker for testing. And then you can set up a shell script to transfer the current version to the slicehost server.

Tool to monitor network connectivity in Windows

What tool would you recommend to monitor the connectivity status of a machine, this is if a given machine it is able to connect to some web servers over time. It should be able to log the status.
There is a long list of freeware at http://ping-monitors.qarchive.org/
I tend to use Nagios and OpenNMS to monitor large batches of servers (and in the Unix environment, not windows). However, some pure windows-only shops I've worked with have really liked using What's Up Gold. Alternately, a combination of a quick perl script, the LWP library from CPAN and the scheduled task manager would probably do the trick too.
When we had to do something similar, we just mocked up some VBS script to attempt to connec to the machines we needed to log. Obviously behind the firewall, on the same domain. Dumped the logs into Excel. Quick and dirty for some network diagnostics, but not a long term solution.

Simplest way to get access to a remote server for computing tasks

I'm working on some academic research projects involving scraping large data sets from the web using Python. It's been inconvenient to work on my academic institution's Linux server because (1) I don't have superuser access, meaning I'm dependent on the IT staff to install my packages, and (2) my disk quota is somewhat limited (I would ideally want ~10 GB). What is the simplest way for me to get access to a machine that solves these problems? I don't need huge processing power; I just need access to a reasonably fast machine that runs 24/7, so that my programs can run continuously, and above all, something very simple to get running, use, and maintain, since I have a few non-CS people working on this project with me. Linux would be preferable, but I'd consider Windows too.
I'm aware of Amazon Web Services, but am wondering if there's something more appropriate to my specific needs.
By the way, it would be a huge bonus if I could get some sort of remote desktop access to this machine so I wasn't limited to using SSH and SFTP.
Suggestions?
EDIT: I can't use VirtualBox or Virtual PC because I need the program to be running around the clock, and I need to turn off my laptop often, etc.
If you do want to stick with running on your CS department's machines, use virtualenv to solve your package installation woes. And if disk space is an issue, you could use S3 (and perhaps FUSE) to store huge amounts of data extremely cheaply.
However, if that's not really what you're after, I can recommend Slicehost very highly. They give you a virtual private server - so you have complete control over what gets installed, users, admin, etc.
In principle, it's very much like EC2 (which I prefer to use for "real" servers), but has a friendly interface, great customer service and is aimed at smaller projects like yours.
Use x11vnc with ssh.
'sudo apt-get install x11vnc' on your remote server.
Once you have that, you can access your remote server via vnc, but the great thing is that you can tunnel vnc over ssh like so:
ssh -X -C -L 5900:localhost:5900 remotehost x11vnc -localhost -display :0
For more details see the x11vnc manpage.
Or, just setup remote desktop -- (which is actually vnc) on your linux distribution. Most distributions come with a GUI to configure remote desktop access.
If you have a linux machine you can use, then SSH -X will allow you to start GUI programs. It's not remote desktop, but it's close.
ssh -X whoever#whatever.com
firefox
Then bam. A firefox window pops on your desktop.
I have been pretty happy with TekTonic Virtual Private Servers. It's a virtualized environment, but you have full root access to install any packages you need. I'm not sure what your CPU and memory constraints are, but if they aren't too extensive then this should fit the bill nicely for you. I don't know if you would be able to enable a remote desktop as I've never tried but it may be possible to install the requisite packages.
The plans range from $15/mo to $100/mo, the $15/mo plan comes with 294MB RAM, 13GB disk space, and 2.6GHz max CPU speed. I ran on that plan for quite a while and eventually moved up to the next level up with double the disk/cpu/mem, and I've been quite happy with it. I've been with them since 2003 and have yet to find anyone who offers equivalent plans at these prices.

Resources