Hello
Quickly sharing some useful scripts I’ve “developed” over the summer to cope with some image resizing / video ripping / transcoding, etc.
Instead of using some specialized GUI software for transcoding I thought why not simply put useful options in the Windows file browser “Send To…” context menu. That way I can right-click the file I want to work with and just send it to some tool to do the job.
Here it is…
Category: Windows scripting
This is the story of my journey to find a way to run a process (or a program on a remote pc)
This wasn’t an easy thing at all…
Overall, I thought, this should be an easy thing to do.
I found this C# code on a Microsoft forums
object[] theProcessToRun = { "notepad.exe" }; ConnectionOptions theConnection = new ConnectionOptions(); theConnection.Username = "username"; theConnection.Password = "password"; ManagementScope theScope = new ManagementScope("<\\\\" + IP + "\\root\\cimv2", theConnection); ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions()); theClass.InvokeMethod("Create", theProcessToRun);
I tried this code, not after forgetting to disable the firewall on the remote computer – a big downside but I guess if I had gone with it I’d hunt a way to stable port to unblock in the firewall.
Then I found the big downside (which can be an upside to some of you):
The remote process this way will never have a GUI window opened (In this example, a process of notepad will be opened in the background).
This can be a big advantage to system admins which want to run scripts.
Ok, back to the quest.
Last week, a friend of mine needed a solution that will auto-restart his PC at a specific time and run a specific task.
Normally, this wouldn’t be a big deal, but his problem was that the PC was inside a domain and required auto-login.
So I dug a bit inside the Windows registry and found a way to do that:
1. I backup all the registry keys in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
2. I remove “legal notice” registry keys, to ensure that it won’t stop the PC from logging in by forcing to press Enter
3. Adding the username, password and domain as default registry keys, setting AdminLogon to True
4. Adding a shortcut in the Startup folder for my Post-Startup script
5. Restarting the PC
after the pc has been restarted, i delete all my added registry keys, and restore the backup. At my post-Restart script I also call the required script he wanted to run (in the attached example it is Windows Calculator)
This solution should only work on Windows 2000/XP Pro
All you need to do is edit postStartup.cmd to run your specific task, and schedule a run for preStartup.cmd with Windows Scheduled tasks (Start -> All Programs -> Accessories -> System Tools -> Scheduled Tasks)
Download Restart Script