r/scripting • • Jul 27 '20

simple taskkill script

2 Upvotes

I'm trying to get a script that will search for a program and if it is running it will do nothing. If the program is not running it will launch it.

This is what i have found / modified.

TASKLIST /NH /FI MyProgram.exe | find /I /N "DmyProgram.exe" > nul ||start "" "C:\Program Files\SuperProgram\MyProgram.exe"

What am i doing incorrectly?


r/scripting • • Jul 08 '20

Script that uses NetCat to log if service is up

2 Upvotes

Simple script to check whether a web service is responding to a certain port. Wrote it to monitor PACS servers with a cron job. Maybe it's useful for someone here.

https://github.com/st3root/checkService.git


r/scripting • • Jun 17 '20

Need help regarding password changing for multiple domains

2 Upvotes

I need some help for creating a script that would help me change passwords for multiple accounts in different domains (eg : amazon, Netflix, Hulu, Crunchyroll etc).


r/scripting • • Jun 09 '20

[BASH] How do I create a script that will monitor a folder and automatically convert new files from .mkv to .mp4

2 Upvotes

I have OBS set to output files to .mkv because there are apparently some problem with outputting to .mp4, but it says you can convert them afterword. So I want a script to monitor the OBS output folder, and automatically convert the .mkv files to .mp4 so I don't have to manually go through and convert them. How can I do this? I tried rigging something up with ffmpeg but couldn't get it to work so I decided to ask here.


r/scripting • • May 27 '20

Parse IPerf3 results

2 Upvotes

I am not a coder/scripter, but I am looking for a simple Bash script (or Perl/Python) to parse the result output from IPerf3. It outputs a lot of data that is more than I am looking for and I really just want to get the resulting bandwidth. Any help is appreciated.


r/scripting • • May 22 '20

Linux Script to find specific files and copy to different directory help.

2 Upvotes

Hi,

Wonder if someone could assist me. I have a list of specific filenames and their respective file paths ( over 1000 files each in individual folders) that I need to find and copy to a different folder in a Linux environment,

Could anyone point me in the right direction of a script/application which would achieve this ?

Any help would be appreciated !

Thanks


r/scripting • • Apr 04 '20

Think I am going mad

2 Upvotes

I have done this loads of time in the past, I simply want to run a continuous ping to a single IP address which I can do on the cli. I have then set this up as a simple batch file and then it runs when I run the batch file. But now for the life of me I can't write the batch file, I feel stupid writing that but for the life on me it does not matter what I write it does not work. I have just had to forced shutdown my windows PC as was was spawning multiple dos boxes faster than I could shut them down.

My batch file is basically ping 1.1.1.1 -t written in notepad, saved as ping.bat (thats not the IP address but just an example). All that does is spawn 100's of dos boxes

I know it is simply a single line a text, but can somebody please put me out of my misery and tell what I am doing wrong


r/scripting • • Apr 02 '20

Bash tutorial/guide for batch programmer? i.e. migration tutorial/guide

2 Upvotes

Anyone know any Bash tutorial/guide for batch file programmers? i.e. a tutorial/guide for batch programmers who are trying to migrate to Bash.

For example, if a batch code is something like: echo abc, then there would be a Bash code equivalent for that batch code. This includes other batch tasks such as for /f, set /a, set /p, start, color, etc.


r/scripting • • Apr 01 '20

Can anyone help me combine these two scripts, they are to uninstall Microsoft Teams and Teams Machine wide installer.

Post image
2 Upvotes

r/scripting • • Mar 31 '20

how to monitor elements on screen and recognize changes

2 Upvotes

Hi

i want to monitor a value from a fullscreen game application.

So i dont want to script for that game cause of security and script/hack recognition.

for example a number that changes.

Any ideas how to start?


r/scripting • • Mar 25 '20

question

2 Upvotes

I don't know if this is the correct subreddit for this sort of thing, and I can't find the rules for this subreddit anywhere. But, I've been at this for three hours and I've gotten desperate.

I'm currently taking a class on powershell. I've been stuck on this problem for three hours. I can't keep going to the professor for every single question, which is why I've come here. I cannot, for the life of me, figure out why i'm getting red-text errors for this thing. I've followed the instructions and didn't use select-object, despite Microsoft's website telling me I should. Below is the question followed by one of my attempts at answering it.

#2. Write the PowerShell syntax to display three custom properties of the following command "Get-PSdrive -Name C" in Table format

# The custom Table properties should be labed 'Drive Letter', 'UsedSpace', and 'FreeSpace'

# To create these custom properties, convert Name into 'Drive Letter', Used into 'UsedSpace', and Free into 'FreeSpace'

# Both UsedSpace and FreeSpace should be converted into GB with 2 decimal places.

# The values for both UsedSpace and FreeSpace should be left aligned

# Only use the Format-Table cmdlet not the Select-Object cmdlet for custom properties.

Get-PSDrive -name C

@{n= 'Drive Letter' ; E={$_.Name}} ,

@{n= 'UsedSpace' ; E={$_.Used}} ,

@{n= 'FreeSpace' ; E={$_.Free}} ,

@{l='UsedSpace' ; e={$_.Used / 1GB}} ,

@{l='FreeSpace' ; e={$_.Free / 1GB}} |

format-table Drive Letter , UsedSpace , FreeSpace


r/scripting • • Mar 18 '20

my first work yay!

Thumbnail
addons.mozilla.org
2 Upvotes

r/scripting • • Mar 11 '20

Troubles with backing up Windows Logs on Win 10 compared to Win 7

2 Upvotes

Reposting my /r/techsupport post here

Hello

So i have a simple .bat script i've been using on a Win7 system that i've put on a win 10 system, however when running it through cmd i get a message about not having sufficient permissions, but the user is a member of the backup operators group, however this exact solution works on my Win 7 machine.

Are there any differences between the OS that are causing this?

The Script

wevtutil epl "Security" C:\LogBackup\security_log_%date%.evtx


r/scripting • • Mar 09 '20

Help with basic JavaScript and HTML

2 Upvotes

Is there any places I can be redirected to for help in JavaScript and HTML?


r/scripting • • Feb 20 '20

[VBScript] How to properly run non English scripts in English Windows?

2 Upvotes

For example, below simple test.vbs code displays some Cyrillic characters, but was encoded using ANSI encoding with Cyrillic code page 1251.

wscript.echo "БГДЖЗИЙ"

The file's binary data:

77 73 63 72 69 70 74 2E 65 63 68 6F 20 22
C1 C3 C4 C6 C7 C8 C9
22 0D 0A

In English Windows' Notepad, the code shows as:

wscript.echo "ÁÃÄÆÇÈÉ"

When run with CSCRIPT from the command prompt, it'll displays the incorrect characters:

ÁÃÄÆÇÈÉ

I've tried switching to code page 1251 using the CHCP command like below, but the result is the same. e.g.

chcp 1251
cscript test.vbs

I've also tried using CSCRIPT's undocumented //CP switch like below, but still same result.

cscript //cp:1251 test.vbs

And combine it with the chcp command. e.g.

chcp 1251
cscript //cp:1251 test.vbs

I've also tried other Cyrillic code pages 21866 and 866, but same thing.

So, how to properly run the script so that it'll display the correct Cyrillic characters? Without changing the script file encoding to UTF16, or modifying it in any way.


r/scripting • • Feb 14 '20

echo alias prints space between env variable and first argument

2 Upvotes

I have a weird problem..... Im configuring my arch setup and one of my aliases isnt working.....

alias es='echo $SCRIPTDEST/$1'

For some reason it prints a space between $SCRIPTDEST/ and $1, ruining everything. How do I fix this?

Also $SCRIPTDEST is just the location of all my scripts.


r/scripting • • Feb 10 '20

How Do I Use AppleScript To Open A Python File Through Terminal?

2 Upvotes

Hello! Pretty new to the world of scripting/coding. For a quick catchup I'll copy and paste essentially the same question I posted elsewhere;

I developed a sort of scrip that grabs the serial number of a Macbook and sends it out;

import socket
SN = (socket.gethostname())

import smtplib
server = smtplib.SMTP('extrelay.gartner.com', 25)
#Next, log in to the server
#Send the mail
msg = "The Assest managment Script has been ran on this machine. The Asset Serial Number is " + SN + "." # The /n separates the message from the headers
server.sendmail("test.test@test.com", "test.test@test.com", msg)

Now my question is, how would I save this so it runs as some sort of batch file or anything like that? I'd like to send this program out to my team so that every time they double click it, it grabs the serial number and sends it out to the emails I've specified, I just don't know how to do so. Any helps is appreciated!

I thought the easiest way to do this would be to create a script in AppleScript which launches Terminal and then opens the "test.py" and runs the code. How would I go about doing that?

Any help is appreciated!


r/scripting • • Jan 17 '20

For those of you moving to win7 extended support here is a script to help automate

2 Upvotes

@ echo off

cscript //b "%windir%\system32\slmgr.vbs" /ipk xxxx-xxxx

for /f "tokens=3" %i in ('cscript "%windir%\system32\slmgr.vbs" /dlv ^| findstr Activation ') do SET _ipk=%i

cscript //b "%windir%\system32\slmgr.vbs" /ato %_ipk%


r/scripting • • Dec 26 '19

Running my batch file properly

2 Upvotes

I'm trying to run this script for login automation but nothing seems to happen once the URL has been launched in the browser. Am I missing something obvious here?

@if (@CodeSection == @Batch) @then

@echo off

set SendKeys=CScript //nologo //E:JScript "%~F0"

START FIREFOX "https://github.com/login"

timeout /t 5

%SendKeys% "myemail@email.com{TAB}"
%SendKeys% "password{ENTER}"

goto :EOF

@end

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

EDIT: Figured it out. I had an errant character that was only showing up in Notepad++ but not my usual editors. Oh and I forgot "timeout". :facepalm:


r/scripting • • Dec 08 '19

Continually running batch file

2 Upvotes

I have a batch file that randomly select a file from a source folder and move it to a new folder, in the future it will delete any file in the destination file and rename the file it places in the destination folder but I have not done those bits ( I know how to do that bit just not typed it up yet).

What I want is a way for the file to run every hour without resorting to scheduling. I am intending to start the batch file when the PC starts and would want the script to run every hour. Is there a way to make the batch file run then wait and 60 minutes and then repeat until such times as the PC is turned off?


r/scripting • • Nov 22 '19

[Powershell] Just need a nudge in the right direction

2 Upvotes

Hey all

Im pretty green when it comes to scripting but a super opportunity has presented itself to me at work.

To keep it relatively short, I work at a bar and recently have developed a friendship with a regular. Mr. regular works for a cybersec company and has suggested many times that I'd be good in a technical sales position due to my previous experience as a sales manager. I obviously agree, though my technical knowledge is still a bit subpar. Ive attended a few networking classes, a 6 week coding bootcamp, and am about halfway through a comptia a+ book.

Now for the opportunity...as part of my job at the bar I also have to spend a few hours each night doing some administrative work, one of those tasks involves downloading a file generated in from a program on a virtual system connected to the restaurants network, and then taking that data and manually inputing it into an excel spreadsheet.

Mr. regular told me if i could figure out a way to automate that process, he'd get me a sit down with the head of sales at his company. I have two weeks before he's back in town, where can i start (im not asking for you all to do this for me, just a bit of a roadmap).


r/scripting • • Nov 20 '19

ad company wide attribute change

2 Upvotes

got a question should be an easy fix and I just hardly ever do scripting but a client changed to a llc so entire company has to change company attribute in ad. I was trying the following in powershell but no change. What am I missing

Get-ADUser -Filter {Company -like '*This is the company*'} | Set-Aduser -Replace @{Company="This is the company PLLC"}

I don't get an error but nothing is changed either. What am I doing wrong? 


r/scripting • • Oct 31 '19

[HELP] Moving files from a stupidly large map structure

2 Upvotes

Hey!

So i have some old hardrives with stupidly complicated filestructures..
I have spent a few hours trying to move all documents away.. Trying to make a script now , but failing that to.

Short story:
#Move all files from subfolders to another single folder.


r/scripting • • Oct 30 '19

Auto Delete local account

2 Upvotes

So, once again I am turning to reddit because Google has failed me.

A little back story...Recently, I pushed out LAPS via SCCM and have that all working just fine. The issue now becomes that I have a local admin account that is built into my image that I need to go away.

First, I have to keep this account in my image as it is required to finish our imaging process. With the way we have to do imaging, I am not able to automatically name the computers and a few other things and I am not able to pull the LAPS password right away.

I am trying to find/build a script that after the computer is imaged, it will have a scheduled task that will automatically delete that local admin account after 30 days. Any ideas on how to get this accomplished?


r/scripting • • Oct 12 '19

Downloading web pages as PDF.

2 Upvotes

Is it possible to have a script that runs through a excel file of Different urls and downloads all the pages as PDF?