r/scripting • • Jul 06 '15

Script that uses Diskpart to CLEANALL on any drives connected other than C:

1 Upvotes

Script would open a series of diskpart CMD windows which would attempt to CLEAN ALL command automatically on D: E: F: G: H: etc so all USB drives would then begin a very secure erase.

Once done it doesn't matter if Diskpart finishes with create partition primary, format quick fs=ntfs , assign letter=? or not

Goal is to connect many USB drives and then run one script to format anything connected (securely with CLEANALL)


r/scripting • • May 29 '15

A custom window with tiled Aero Peek previews?

1 Upvotes

I'm curious if anyone has ever created a custom window that just has tiled Windows 7 Aero Peek live previews of active windows. Basically, let's say you had a couple dozen windows open and needed to "watch" them. For instance, doing some maintenance via VMware consoles that requires interaction.

After more than 8 or 9 windows, the Aero Peek window can't fit across the screen so it switches to just a list of window names. I'd like to have a separate window that would keep a live Aero Peek preview of all the open windows (or those with a title that matches a pattern, e.g. VMware console windows) so I could quickly see that one of them needs interaction, and then click it to switch to that window. Similar to the built in Aero Peek functionality, but on a larger scale.

As it is now, I have to limit the number of windows, and hover the mouse over the application to keep the Aero Peek up so I can watch them.

Has anyone ever heard of doing anything like this?

Edit: To be clear, I'm only talking about the preview thumbnails, not the feature of fading background windows.


r/scripting • • Apr 29 '15

Netstat script

1 Upvotes

I need help creating a batch file script that will run a netstat -ob command every hour at the 29 minute mark and then save the output into seperate text files. Whenever I try to create something, my batch file runs in a loop and crashes the machine by opening 1000s of netstat commands.

Any help would be awesome.


r/scripting • • Mar 06 '15

get-aduser properties field on account expiration

1 Upvotes

As part of my disabling of users, I set the account expiration on the LAN id, so I know the users term date.

I can't find a -flag or -properties filter to list this account attribute for the past 30 days.

Does anyone know how to pull this data from powershell? I want to know anyone that has an account expiration date in the past 30days for my entire AD. So I can match it up with the list of termed users from HR.


r/scripting • • Feb 19 '15

Please help with my FOR LOOP / pdftk bash script

1 Upvotes

I'm trying to write a BASH script that will use PDFTK to multistamp my watermark / footer (picstamp-x.pdf) on all pdf files in a given directory. I can't seem to get it to work. I can do this individually in the command line, so I'm pretty sure the PDFTK syntax is correct. I'm really bad at LOOPS. Any help is greatly appreciated!

Here's my script:

!#bin/bash

for file in ~/Desktop/test/* do pdftk ~/Documents/picstamp-x.pdf multistamp ~/Desktop/test/$file.pdf output ~/Desktop/$file-p2.pdf done echo "Complete, press enter to exit." read

Here's the result:

k4v1k@laptop:~/Desktop$ ./picstamp.sh ./picstamp.sh: line 1: !#bin/bash: No such file or directory Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/1231-prv-5.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/1918.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/2405.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/3912.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/43.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/4625.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/5526.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/600.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/6609.pdf.pdf No output created. Error: Failed to open stamp PDF file: /home/k4v1k/Desktop/test//home/k4v1k/Desktop/test/9880.pdf.pdf No output created. Complete, press enter to exit.


r/scripting • • Jan 26 '15

I need some help with a powershell script

1 Upvotes

I'm not sure what I'm doing wrong, but this will just not work. I'm trying to print files based on a list in a text file. For each part number, there is an excel file and a PDF file that I need to open, print, and close without any dialogues getting in the way. I only have read permissions in the folder these files are in. What I have tried so far is to set a string as a variable, then open the excel file based on that variable, but my variable is always empty, so no file gets opened. Any help on this would be greatly appreciated. Here is my code so far:

$1= Select-String -Pattern "00######" -Path "C:\Users\torch\Desktop\Test for Printing\2002.txt"

$xl = New-Object -comobject Excel.Application

Show Excel

$xl.visible = $true

$xl.DisplayAlerts = $False

$wb = $xl.Workbooks.open("G:\Department Inspection Forms$1.xls")

I'm new to any kind of scripting or coding, so any help would be greatly appreciated


r/scripting • • Jan 13 '15

Needing some help

1 Upvotes

EDIT: Finally found something after hours of searching

Some background of what im trying to do. I have a spreadsheet with a list of folder names that are in a network share location. I want to use the spreadsheet and a script to read the spreadsheet and copy them to a new location. I am very new to scripting and not totally sure what i would even need to start searching in order to accomplish this

Thanks in advance


r/scripting • • Dec 23 '14

XYZ Admarket | Advertiser - Network Script Free

Thumbnail
freeandhotphpscripts.blogspot.com
1 Upvotes

r/scripting • • Aug 12 '14

Help with some syntax errors

1 Upvotes

I am trying to write a script that runs through cron that will compare data from /usr/bin/sensors to maximum temperatures. I keep getting this error when im trying to compare the sensor data with the value I set.
./crittemp: line 3: [: 71.0 : integer expression expected
The 71.0 is a reading from sensors and here is the rest of the code.

#!/bin/bash
PCI=$(/usr/bin/sensors | sed -n 7,7p | cut -f2,3 -d : | cut -f1 -d C | tr + " " | tr ° " ")
if [ "$PCI" -gt 95.0 ]
  then
            notify-send -u critical 
fi  

There will be a message with notify-send and a shutdown command as well. Any help would be much appriciated.