Newest scripting Questions

Q&A for system and network administrators

whoami /priv for another user

Is there a way to see the privileges for any (local or domain) user in Windows ? whoami /priv works for the current user. Not clear from the docs: https://technet.microsoft.com/en-us/library/cc771299(...

Entering local admin username and password in a script

I have alot of clients on my network and I want my script to do the following: [1] Open an elevated command prompt using the local admin details. Note: I do not want to have to enter a username ...

Check microphone level and change accordingly via script

I am trying to check what the existing volume on client workstations is and set to x (let's say x = 16.5). I figured out how to set the volume via cli which is using nircmd. To be specific: nircmd....

Don't work correctly script in bash

I need to get interface by number. My script: #!/bin/bash interfaces=/root/tt interfaces_with_numbers=/root/tt2 ls -1 /sys/class/net > /root/tt cat -n $interfaces > $interfaces_with_numbers ...

Script to search bots from log file

I have a little log-file, where i should find the bots. File: Mon, 22 Aug 2016 13:15:39 +0200|178.57.66.225|fxsciaqulmlk| - |user logged in| - Mon, 22 Aug 2016 13:15:39 +0200|178.57.66.225|...

How create directory structure with permissions from web?

I have a directory structure in a shared folder with specific folder permissions for making projects in a Active Directory Domain like \server\shared\Projects\Project1, \server\shared\Projects\...

Finding script trying send spam via postfix

I have had this problem before with crap wordpress sites on my server but it was always easy to find the source, a php script by looking at the spam header and see the php scripts name. But this time ...

Pure Perl RPM Version checker

I have a machine located in a secure environment that does not have access to the internet. I has a base load of CentOS with a handful of additional RPMs. This includes a basic install of PERL with ...

What are the Associated Extensions for the Interpreter memcached.exe

What are the Associated Extensions for the Interpreter memcached.exe I want to program Abyss Web Server to manifest Interface FastCGI (Local - TCP/IP Sockets) for Interpreter Memcached.exe for ...

Bash script aborting after defining lsb functions

I'm currently trying to get a script to work, which needs to define some LSB functions. This is happening here: echo "step 1" # Read configuration variable file if it is present [ -r /etc/default/$...

Launch AD for alt domain batch stopped working after win10 upgrade

I have a simple batch script that I have been using to launch the AD Users and Computers modules for domains other than the one my current session is logged in to. I've been using this for longer ...

AWS ELB - how to attach the latest/newest snapshot automatically?

I'm really new to AWS ELB and I'm reading about how to automatically mount an EBS volume from a snapshot via the ebextensions script. I've found this post as a reference: https://aws.amazon.com/blogs/...

Powershell script to export email address of users in an OU

so I have a ton of OU's on our DC that are all formatted the same way with a 6 digit number to start and then a name after the number. I am wondering if there is a way to write a Powershell script ...

Execute command on multiple files

I need to execute jpeg-recompress on thousands of files. I've tried: for image in *.jpg; do image2=${image%.*}.jpg; ./jpeg-recompress /path/to/images/$image /path/to/images/$image2; echo "...

Changing root password via script fails but reports success

I have a project which requires me to make a script / sequence of commands to change the root password on a CentOS 7 installation. I can assume the user that will be executing the script is already ...

RedHat Cluster Manual Service Startup Script

Due to some issues with cluster stability and how often we only have a very limited time available in which to work, frequently we will need to restore the service running in the cluster even when the ...

how to use windows printing_admin_scripts independent of system language

The windows "printing_admin_scripts" are located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory While %WINDIR% is defined within the windows SET variables, the value of &...

Running script on instance that is created from AWS snapshot

I've a AMI that I'd like to launch more instances based on this. But seems when I create instance based on this images, it doesn't boot-up. So the scripts that I would like to run on startup doesn't ...

How to use wget in an Expect script?

I first download a file to /root/TRY1/: #!/usr/bin/expect cd /root/TRY1/ exec wget --http-user $user --http-password $password $url Then I want to extract the file: cd /root/TRY1/ exec bash -c "tar ...

Plugins and skripts for munin master or munin node?

I am new to munin monitoring. I am a bit confuse about two things about munin. First: Do I put plugins or scripts(self written) in munin master or munin node (a host to be monitored) for able to ...

powershell: how to print command to file?

I'm currently using the Out-File cmdlet, like so: PS> Some-Cmdlet -someswitch | Out-File -filepath .\somefile.txt It works great. Is there anyway that I can actually get the command line itself ...

How to minimize missed events using WMI Polling with __InstanceCreationEvent?

I'm using a WMI query (shown below) to capture when a process is created, however a lot of processes that run quickly are missed. For example, if I set polling to every 30 seconds, then a process that ...

batch script to download office 2016 install files

Writing a powershell script to run via my RMM agent that will copy Office 2016 Deployment Tool from my server to theirs then try to run the initial download to help ease my deployment process. These ...

content_filter not executed after script python

I'm using postfix with dovecot. I had a content_filter with a specific script but when I receive a mail the dovecote filter is not executed I try to call the dovecote filter in same time than my ...

Find old files in directory

I'm writing backup rotation script, that suppose to take all files older then 5 days and delete them. Problem is that i've got some weird search results. for example: [root@spr1-nas01 storage]# date ...

Replace a string once another string has been found

I'm programmatically building boxes, but I need to update a .repo file for PHP which has the following contents: # Repository: http://rpms.remirepo.net/ # Blog: http://blog.remirepo.net/ # ...

Powershell send CTRL A

I am tryng to make a .bat in order to launch a program, and save the result as a txt file. The issue is in order to save you have to select some line so i would like to do a CTRL+A and a save as in ...

Need leading zero for batch script for time before 10am [duplicate]

I came across a bug in my script Anytime before 10am two folders are created (check image link) - one with the date and one with the time. After 10am only one folder. Any ideas how to add an extra 0 ...

batch file to install application (Adobe Reader)

I previously used ninite to install this. However, this is no longer supported through ninite anymore. I usually install this manually but I know where a way to automate this using a batch script of ...

Don't work loop on bash

I have written script on bash. It got all list of interfaces. And in loop has compared with variable. But it doesn't work good. My script: #!/bin/bash search=`ls -1 /sys/class/net | grep -v lo` echo ...

Searching of bots from log-file [duplicate]

I have written this message before. So, i have done my task, but i have a little not correct output. So... I will start. I have a log file: Mon, 22 Aug 2016 13:15:39 +0200|178.57.66.225|fxsciaqulmlk| ...

How to use sed to replace text with special characters.

I currently have a script that generates random words to create passwords. I run this by selecting the script and letting it know how many words I want .e.g ./generate_passwords.sh 5. This creates ...

Powershell: a simple script to take a list of commands and append the same cmdlet every time [closed]

I have a list of commands I run in a script like this Some-Cmdlet -someswitch | Outfile -filepath .\somefile.txt -append Another-Cmdlet -someswitch | Out-File -filepath .\somefile.txt -append Hello-...

How to show lines where uniq more than 3

I have a file, where i should make "uniq" and show result. My file: 178.57.66.225 fxsciaqulmlk 178.57.66.225 fxsciaqulmlk 178.57.66.225 fxsciaqulmlk 178.57.66.225 faaaaaa11111 178.57.66.215 ...

Backup powershell script pauses until i press space

I made a script to export all mailboxes ( as secondary backup for my Exchange 2013 Server.) The script basically gets all the mailboxes from a list in a text file and does a for-loop going through ...

TrimStart() improperly truncates string

I wrote a script to backup bitlocker keys to Active Directory. The works great unless the Password ID starts with 'D'. Here is script #Get recovery info $recoveryinfo = manage-bde -protectors -get c: ...

Script to delete FTP data older than 7 days

Currently I am using following simple line script to take backup of server directory to remote FTP location # Take backup to remote location ncftpput -z -R -uusername -ppassword ftp.example.org /...

std output and error from functions

Is there a way to get the standard output and estandard error from the functions inside a bash script? This is what "I thought" I was trying to accomplish with my script: #!/bin/bash LOGS="tmp/sync....

Script to export many AD Groups' Properties/Attributes to csv

I have a list of about 1,000 Active Directory security groups (the list is in Excel, but I can save as csv or copy and paste into a txt file). I would use it to get the following properties/...

Force all domain users to have a specific “search folder” in outlook

I want to implement in my domain by GPO or by script that all of the users will have a "search folder" in outlook that searches for items larger then 5 MB. I want to be able to tell users who had ...

Grep by block of text\lines

I have the text, that contains some lines. So, i need to make GREP of several lines. For example, i have repeating text and i should GREP get lines, that have this repeating key-words. grep -o "test|...

Read Gmail emails using Powershell [migrated]

We want to automate actions based on emails we receive by email from different management systems from devices in our network I have tried this small script, but it lists only the subject, not the ...

How to compare duplicate files in the same directory and hardlink them together [migrated]

i have variable that i used to represent duplicated files found in a certain directory ddub=`find $1* -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} find -type f -size {}c -...

bash script to detect when a file is added to folder and command exec

I am trying to write a script to detect whenever a file is added to a specific folder and run a command using the last file added name. What I am specifically trying to do is to create a QR code for ...

hpacucli.exe opening in a new cmd

I am trying to collect the output from hpacucli.exe on Windows in PowerShell. I am using the following code: $execPhysical = & $hpacucli 'ctrl all show config' Write-Output $execPhysical For ...

Execute script when new email arrives (Postfix / Dovecot)

I want to execute a backup script (.sh) when I receive a new mail on my mailserver (running on Debian with Postfix / Dovecot). I've found many posts on this topic, but no one give me a working ...

Exchange 2013 script to copy email from a users inbox for a specific date range?

Client Mailbox Exchange 2013 Microsoft Scripting Looking for a script that will accomplish the following task. Copy all email from a user’s mailbox that meets a specific date. The copy script should ...

wrapper script for mail.log / postfix database

I maintain a mailserver sending around 50k emails a day from a handful of mailadresses. I need to evaluate quite often questions like how many mails were send today by emailadress x which emails send ...

Need script to replace TEXT in selected files

Environment Windows 10, C:\Folder_With_VMXfiles, installed sed for windows Tools: Batch script, sed for Windows Requirements: In folder C:\Folder_With_VMXfiles Need to replace some text inside the ...

How to get AD user's “Display name” instead of logon name (domain\userid) while exporting “send as” and “full” permissions?

I have googled and created two scripts . (1), (2) (1)First one is to export "Full Access" of a shared email box called "ap.cz" Get-Mailbox ap.cz | Get-MailboxPermission | where {$_.user.tostring() -...
Translating... 0%