Scripting Languages

26K

Solutions

20K

Contributors

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.

Share tech news, updates, or what's on your mind.

Sign up to Post

is this a php script?how to use it? is for creating a source.txt

<?php
$ips = $_POST['ips'];
$users = $_POST['users'];
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
$key = rand_string(8) . ".txt";
$fh = fopen($key, 'w') or die("can't open file");
$ips=explode("\n", $ips);
$users=explode("\n", $users);
foreach($ips as $ip){
foreach($users as $user){
$string= $ip.":".$user;
$string = preg_replace('/\s+/', '', $string);
fwrite($fh, $string);
fwrite($fh, " \r\n"); }}
$print = "Done! Poti sa descarci fisierul sursa si sa il adaugi in dubrute <a href=http://hiphopize.me" . $key . " >Click</a>";
echo $print;
?>

Open in new window


<html>
<head><title>RDP_SRCBuilder</title></head><center>
<body><form method="POST" action=create.php>Ips:<textarea id="ips" name="ips" cols="40" rows="15"></textarea>Users:<textarea id="users" name="users" cols="40" rows="15"></textarea><br><input type="submit" value="Show them all!"></center><br>
</body></html>

Open in new window

0
Free Tool: SSL Checker
LVL 10
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi guys,
I need some help.
We are writing a little system that will catch mails sent from various monitoring systems and then pass them via API to Telegram (t save money on SMS plans)

Some of the mails are coming in a very easy to read format and they are already working. However mails sent from a certain system are giving me some trouble.

The way the system works is as such:
1) mail is received by postfix
2) mail is passed on to a script as stdin
3) mail is broken down to sender, subject and body via the script
4) script sends the generated values to the API and the people to whom it's relevant gets a message on Telegram.

All of the above is working well, unless I get a mail from a certain system that stumps the process.
After reading through the stream that's passed to the script, I figured out the problem is in the body.
I'm attaching part of the passed stdin with personal info removed

From: Someone
To: Someone else
Subject: test 3
Thread-Topic: test 3
Thread-Index: AQHTLGwuurwZ5el20EqN9dDhKU6/Vg==
Date: Wed, 13 Sep 2017 08:42:06 +0000
Message-ID: <0cb743aa4535462f8158bdba321abbd8@server>
Accept-Language: en-US, he-IL
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [213.8.94.213]
Content-Type: multipart/alternative;
      boundary="_000_0cb743aa4535462f8158bdba321abbd8MBX7gohostcoil_"
MIME-Version: 1.0
X-Originating-IP: 1.2.3.4
X-SpamExperts-Domain:
0
People,

Can anyone here please assist me in modifying the PowerShell script below to list all server and appliances that are still sending out email using the IP address of my physical Exchange Server 2013 (MBX-CAS role) except certain Exchange IP address list ?

For Example in the below Powershell, I wanted to exclude ClientIp: 10.1.1.125, 192.168.1.125 and 10.15.77.122 to not included in the CSV result.

Get-MessageTrackingLog -Server PRODMBXCAS-14-VM -resultsize unlimited -Start "12/08/2017 1:00:00 AM" -End "12/09/2017 11:59:00 PM" | where-object {$_.EventId -eq "RECEIVE"} | Select @{Name='Recipients';Expression={[string]::join(";", ($_.Recipients))}}, Sender, EventId, Timestamp, Source, MessageSubject | Export-CSV –Path "C:\Result\Dec2_Email_Statistics_Receive.csv" -NTI

Open in new window


How can I get that into the script above ?

After reading: https://technet.microsoft.com/en-us/library/bb124375%28v=exchg.150%29.aspx  What's the difference between:

Where {$_.OriginalClientIp -notlike "192.168.1.125"}
Where {$_.ClientIp -notlike '192.168.1.125'}
0
Hi,
I need help writing a batch file code that will run the first code, launch a program (.exe)  and than once program(.exe) exits run the second code.  
1st code
if exist C:\Windows\System32\nvapi64.Old goto Old
chdir /d C:\Windows\System32
ren nvapi64.dll nvapi64.Old
echo @ Named
pause

Open in new window


2nd code
chdir /d C:\Windows\System32
ren nvapi64.Old nvapi64.dll
echo @ Renamed
pause

Open in new window

0
Hi People,

I’d like to request some PowerShell scripting help for testing document download and access that have been published by my users to the cloud service.

Steps to do:
1.      Loop through the month directory and then get all PDF published in that directory, then save it to C:\Test\Result\
2.      Go to the next month and then perform the same thing as above

URL:
January 2017
https://CompanyName.s3.amazonaws.com/Uploads/Finance/201701/20170101-USR-Report.pdf
https://CompanyName.s3.amazonaws.com/Uploads/Finance/201701/20170102-USR-Report.pdf 

https://CompanyName.s3.amazonaws.com/Uploads/Finance/201701/20170131-USR-Report.pdf 

Open in new window


 …

August 2017
https://CompanyName.s3.amazonaws.com/Uploads/Finance/201708/20170801-USR-Report.pdf 
https://CompanyName.s3.amazonaws.com/Uploads/Finance/201708/20170802-USR-Report.pdf  

https://CompanyName.s3.amazonaws.com/Uploads/Finance/201708/20170831-USR-Report.pdf 

Open in new window


I wanted to test if the user published the document as per the standard naming convention or not.

Any help would be greatly appreciated.

Thanks,
0
I need a powershell script that will ping a dns name and if it replies, set a registry value in HKEY_CURRENT_USER to 1 and if its not pingable set the registry value to 0.

I appreciate the help with this?
0
Hi Experts,

As part of an imaging process using a third party utility I am able to create a computer name and login as local admin. I need to run a batch script which will add the machine to the domain using this new computer name. Can someone provide examples that have worked for them?

Thanks
0
Hi guys,
I have to rename a bulk of shared mailboxes to a new format, the script is ready and works but when the script runs, the names that contains accentuation are not being updated properly and a question mark is shown where the accentuation should exist.


-----------------------------------------input file:
name,NewName
BMS-cipatubarao,"CIPA Tubarão"
BEL-liberacaeodelimbo-amd,"Liberação AMD"

-----------------------------------------Script:
$sharedChange = Import-Csv .\"SHAREDchange.csv"
$sharedChange | foreach{
      $sharedName = $_.name
      $sharedNewName = $_.newname
      try {
      # Change the DisplayName on Services Domain
            set-user $sharedname -displayname $sharedNewName
            "$(get-date -f MM/dd/yyyy-HH:mm:ss), $sharednewname, modified on, $sharedname`n" | out-file '.\SharedSuccess.txt' -append
      }      catch {
            "$(get-date -f MM/dd/yyyy-HH:mm:ss), $sharednewname, NOT modified on, $sharedname`n" | out-file '.\SharedFailed.txt' -append
      }
}
-----------------------------------------output file:
09/04/2017-17:47:12, CIPA Tubar�o, modified on, cipatubarao
09/04/2017-17:47:14, Libera��o AMD, modified on, liberacaeo-amd

What should I do?
I have already tried to use the command directly on my shell using set-mailbox liberacaeo-amd -displayname "Liberação AMD" and it works, but as I have a batch of shared mailboxes to execute this change, this is completely out of  question.
0
Please provide me with the correct syntax for granting a user full access to another user's Office 365 calendar by using the Office 365 Power Shell.

For example this command grants a single user full access to everyone's calendar within Office 365.

How can this power shell command be modified to grant a single user access to another user's Office 365 calendar?

Get-Mailbox | ForEach-Object {Add-MailboxFolderPermission $_":\Calendar" -User msmith@company.com -AccessRights Owner}

Open in new window

0
I created a simple .bat file to delete a website in our favorites. It works locally but I need to add it to a GPO to deploy to remove it off 100's of machines. Can someone assist with step by step instructions on how to do this? I have not done this before.

Thanks for any assistance.


del "c:\users\%username%\Favorites\website.url"
0
On Demand Webinar - Networking for the Cloud Era
LVL 10
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

i need to search for particular word "error" in log file that was created for last one hour (or) last hundred files.
0
An online reviewer downloads tens of thousands of video and music files and it is a real mess with no organization. Additionally they have some on their laptops, others on their PCs and then some on several servers, with a few on MACs. Fortunately the MACs are few in number so I can manually move all those files but for the rest I would like to be able to take all the files, use their file names and create folders with the name and then move all the files with matching names into the matching folder. Looking at the video files (most of which are TV shows) they have a fairly consistent naming convention which I hope will make automating this process possible. Generally speaking the name of the video files are "name of the TV show then season number then episode number", example "Americas Got Talent S02E07". So would it be possible to take all of the name but not the S02E07 and create a folder "Americas Got Talent" and then move all the files that match that name into the newly created folder. The MP3's (mostly music but some are podcasts) do not have this "consistent" naming convention so not sure what to do here -- but if I can get the videos organized I think switching them to Media Monkey for future podcasts and music should provide the organization needed. Thanks!
0
Hi All,

Greetings of the Day...

As per my work, I have to ftp zip files from one server to another..FTP part is done with my code. After FTPing, I need to compare the count of files present in the zip file to make sure while transferring nothing get missed..If it get miss,need to perfrom FTP again.

How can perform the above described task with batch Script.?

Any help regarding this is highly appreciated.

Thanks in Advance.

Have a nice Day...
0
I had this question after viewing How to create Email signature based on specific template for each people in certain OU ?.

People,

I have successfully deployed the script from: https://gallery.technet.microsoft.com/office/Set-Outlook-20102013-8341e049
as the User Configuration | Logon Script.

<# 
.SYNOPSIS 
Script to set Outlook 2010/2013 e-mail signature using Active Directory information 
.DESCRIPTION 
This script will set the Outlook 2010/2013 e-mail signature on the local client using Active Directory information.  
The template is created with a Word document, where images can be inserted and AD values can be provided. 
 
Author: Daniel Classon 
Version 2.4 
 
.DISCLAIMER 
All scripts and other powershell references are offered AS IS with no warranty. 
These script and functions are tested in my environment and it is recommended that you test these scripts in a test environment before using in your production environment. 
#> 
 
 
#Custom variables 
$SignatureName = '' #insert the company name (no spaces) 
$SigSource = "" #Change if desired for signature templates 
$SignatureVersion = "1.0" #Change this if you have updated the signature. If you do not change it, the script will quit after checking for the version already on the machine 
$ForceSignature = $False 
  
#Environment variables 

Open in new window

0
Hi All,

We would like to pull the report that contains meeting details of a room mailbox. We would like to pull the below details using script.

1)Organizer
2)Date
3)Start time
4)End time

Your comments and help will be highly appreciated.

Regards,
Srini A
0
Hi,
i need ideas (or a script) how to search all MAC Addresses of a windows system and pass these as parameter to an external program...with PERL.

script should do the following:
1. get all MAC-Adresses (LAN1, LAN2, WLAN,...)
      = AA-AA-AA-AA-AA-AA , BB-BB-BB-BB-BB-BB , CC-CC-CC-CC-CC-CC-CC

2. start external programm and pass every MAC (one after another) ... possible within a loop
extProg.exe AA-AA-AA-AA-AA-AA
extProg.exe BB-BB-BB-BB-BB-BB
extProg.exe CC-CC-CC-CC-CC-CC-CC
0
Hello I have this code in HTML and VBScript


<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<META http-equiv="Pragma" CONTENT="no-cache">
<TITLE>Support</TITLE>


<title>Form to Support</title>
<style type="text/css">
<!--
.style1 {color: #ffffff}
.BotonExit {
	color: #ffffff;
	background-color: #ff0000;
}
.BotonSubmit {
	color: #ffffff;
	background-color: #336699;
}
.BotonReset {
	color: #ffffff;
	background-color: #336699;
}
-->
</style>
</head>
<body> 
<SCRIPT>
	
</script>

<%



'Single Variable Declarations
Dim myString, racecn, cn, stringrace

racecn = Request.QueryString("racecn")

if racecn = "" then racecn = "General Topic"

Session("cn") = racecn

Session("maestrocn") = racecn


%>



<div align="center">
<form method="POST" action="cdosys.asp" name="form1">




<%
Response.Write("Question: <b>" & Session("cn") & "<br /></b>")
%>



 	



</form>
</div>
</body>
</html> 

Open in new window


now this code is .asp and I call like http://xxx.xxx.xxx/file.asp

For example if I want to pass special characters like:

http://xxx.xxx.xxx/file.asp?racecn=M%F3dulo%201%20exp

The results are:

M�dulo exp

The result must be: Módulo 1 exp

How can be fixed?

Note:

If I use like this:

http://xxx.xxx.xxx/file.asp?racecn=Módulo%201%20exp

works but I don´t want that because I´m passing the variables from other page.

Then what can be added or removed to the script above to accept:

http://xxx.xxx.xxx/file.asp?racecn=M%F3dulo%201%20exp

and results in:

Módulo 1 exp

instead of the corrupted M�dulo exp

Thank you
0
I had this question after viewing Powershell code used to work.


Cant seem to find a way to return Home team and time

CLS
$weeks = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
$wc  = New-Object System.Net.WebClient;
$doc = New-Object HtmlAgilityPack.HtmlDocument

Foreach($week in $weeks){

$Website = "http://www.espn.com/nfl/schedule/_/week/$week/seasontype/2"
write-host $Website
$doc.LoadHtml($wc.DownloadString($Website))

# Day headers - need to assign that per index later ...
$days = $doc.DocumentNode.SelectNodes('//div["sched-container"]/h2') | Select -Expand InnerText

$games = @()
$AllGames = @()
$index = 0
foreach ($day in $doc.DocumentNode.SelectNodes('//table["schedule"]'))
{
  $day.SelectNodes("tbody/tr") |
    % {
      $data = $_.SelectNodes("td/a")[0..5] | Select -Expand InnerText
      $games += New-Object PsObject -Property @{
                   Day     = $days[$index]
                   Visitor = $data[0]
                   Home    = $data[1]
                   Time   = $data[2]
                }
        

    }
  $index++
}

$games | select  Day, Visitor, Home, Time | Format-Table -AutoSize

}

Open in new window

0
I need help powershell script to wmi query to check supported  machine model  if it's not equal it should msg pop out it should exit. msg pop out this model is not supported.
I'm using this for unsupported model in Windows deployment. thanks
0
Hire Technology Freelancers with Gigs
LVL 10
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Hi All,

how do I put the code below in an if statement:

                    $Mgr = Get-ADUser -Filter "employeeNumber -eq '$($user."Manager Employee Number")'" | Select -ExpandProperty DistinguishedName
                    
                    Get-ADUser -Filter "EmailAddress -eq '$($user.email)'" | Set-ADUser -manager ($Mgr)
                       
                    Write-Host "$user.first Name" + "Manager information has been updated" -ForegroundColor Green

Open in new window


if the first code completes "$Mgr = ............." the to run the next code which is "get-aduser...." and if that code completes then to write-host "....."

thank you in advance,
Kelly
0
Hi All,

I have this powershell script that edits ad users based on a csv.

#Known Issues:
#Source CSV should not have fields that are null. Remove any rows with null data. Email and Directorate are common. (HR to fix)
#Source CSV has duplicates. Fine. First will be overwritten with second. (HR to fix or not)
#Source CSV has shop accounts. Remove them. It breaks O365 (In Cloud) accounts. Remove any @crshop.org.uk emails.
#Source CSV has emails with apostrophe in, which do not work. Remove any emails with apostrophes in.
#Source CSV has headers with excess spaces after the names, such as "Department " instead of "Department". Correct this. 
#Test before running on a couple of accounts.

# Import AD Module             
Import-Module ActiveDirectory            
Write-Host 'Starting to update AD Attributes.......' -NoNewline -ForegroundColor Black -BackgroundColor Cyan

# Gets the date, data sting and import CSV into variable $users           
$date = Get-Date -format "dd/MM/yyyy"
$dateString = $date.ToString()
$users = Import-Csv -Path "path\test.csv"

foreach ($user in $users) {
    #Search for Managers DistinguishedName using the managers EmployeeNumber 
    $Mgr = Get-ADUser -Filter "employeeNumber -eq '$($user."Manager Employee Number")'" | Select -ExpandProperty DistinguishedName
    #Get User emails from CSV file and update attributes on AD           
    Get-ADUser -Filter "EmailAddress -eq '$($user.email)'" | Set-ADUser -Office $($user.location) 

Open in new window

0
I have a single field in a log table that contains this data:

Is it JSON?

How do I extract just the email address following the "to" field?

I have a text file version and could use some other scripting tool, even Excel, if it could work.

Thanks.

{"event": "failed", "severity": "temporary", "tags": [], "mailing-list": {"list-id": "satb_mailing2_nonspam.m.satb.com", "address": "satb_mailing2@m.satb.com", "sid": "1288499"}, "timestamp": 1446076551.295771, "envelope": {"targets": "sb@reply.sb.com", "transport": "smtp", "sender": "postmaster@m.satb.com"}, "delivery-status": {"code": null, "message": null, "retry-seconds": 900, "description": "MX lookup failed", "session-seconds": 0.0}, "kafka": {"topic": "iad_pipeline_events", "msg_size": 1761, "partition": 1, "key": "NTVmMWU0OTg3OGZhMTY0ZmQzYWUxMDg5", "consumer_group": "logstash-customer"}, "campaigns": [{"id": "g7d2t", "name": "BapChOwn"}], "log-level": "warn", "reason": "generic", "user-variables": {}, "flags": {"is-routed": null, "is-authenticated": true, "is-system-test": false, "is-test-mode": false}, "recipient-domain": "reply.sb.com", "message": {"headers": {"to": "scottbrown@reply.scottbrown.com", "message-id": "20151028223554.10459.56766@m.satb.com", "from": "Roberta <rob@satb.com>", "subject": “CWC!”}, "attachments": [{"filename": "Golden__MP3s_and_PDFs.zip", "content-type": "application/zip", "size": 26089706}], "recipients": ["sb@reply.sb.com"], "size": 26125372}, "recipient": “sb@reply.sb.com", "id": …
0
Hi Experts,

I'm trying to modify my current function to have an option to filter by a combined field in case user types a space.

current
ALTER FUNCTION [dbo].[EmployeestblSelectByFirstPH] (
@sWhere varchar(2000)
) 
RETURNS TABLE
AS
RETURN 
    SELECT top 100
         ID, FirstName + ' ' +  LastName as Name, Title
         from dbo.Employeestbl
         where FirstName like   @sWhere  + '%'
         And     (NOT EXISTS
                          (SELECT     EmployeeID
                            FROM          dbo.TovInfo
                            WHERE      (Day >= GETDATE() - 60) AND (EmployeeID = dbo.Employeestbl.ID))) AND (dbo.Employeestbl.Title = 'rn' OR
                      dbo.Employeestbl.Title = 'lpn') AND (NOT (dbo.Employeestbl.EmployeeStatus IN ('Inactive', 'Disapproved')) OR
                      dbo.Employeestbl.EmployeeStatus IS NULL)
         order by FirstName, LastName

Open in new window


to something like following

USE [PlacementNP]
GO


ALTER FUNCTION [dbo].[EmployeestblSelectByFirstPH] (
@sWhere varchar(2000)
) 
RETURNS TABLE
AS
RETURN 
    SELECT top 100
         ID, FirstName + ' ' +  LastName as Name, Title
         from dbo.Employeestbl
         where 
			case when CHARINDEX(@sWhere,' ')=0 then
				FirstName like   @sWhere  + '%'
			else
				FirstName + ' ' + LastName like   @sWhere  + '%'
			end
         And     (NOT EXISTS
                          (SELECT     EmployeeID
                            FROM          dbo.TovInfo
                            WHERE      (Day >= GETDATE() - 60) AND (EmployeeID = dbo.Employeestbl.ID))) AND (dbo.Employeestbl.Title = 'rn' OR
                      dbo.Employeestbl.Title = 'lpn') AND (NOT (dbo.Employeestbl.EmployeeStatus IN ('Inactive', 'Disapproved')) OR
                      dbo.Employeestbl.EmployeeStatus IS NULL)
         order by FirstName, LastName

Open in new window


My question is how to accomplish that to perform in the most efficient manner?

Thanks,
Ben
0
Greeting Experts,

I need some help creating a script that can scan a list of DHCP servers for Mac address and come back with its IP address/DHCP Server is on.  Our ACtive Directory is large and going throw each DHCP server looking at the Mac address would take too much time. can somebody help me with this task. thank
0
Hi Experts,

I am trying to do automate New Disk addition, It will scan and check for new disk name and creates New PV.

Issue with script is , while i am trying to use this script its takes already partitioned old disk and partitioning... How to avoid that ... I am in learning stage of bash script... Help much appreciated

#!/bin/bash
# fix-rh-newdisk
ADDVG=$1 
[ -z "$ADDVG" ] && ADDVG=system 

OSVER=$(uname -r | grep -q '\.el6' >/dev/null && echo '6' || echo '5') # get OS verstion

  rm -f /etc/lvm/cache/.cache;   /mnt/install/rh-misc-packages/rescan-scsi-bus.sh >/dev/null 2>&1

# If there is any stdout then the disk is in use; if there is any stderr then 'failed to stat() /dev/sd?'
  FFREE_OUT=/tmp/$$
  FFREE=; for D in {b..i}; do
    kpartx -l /dev/sd${D} >$FFREE_OUT 2>/dev/null; RC=$?;
    [ $RC -gt 0 ] && break       # don't want to include the disk as a possible if failed to stat
    [ -s $FFREE_OUT ] && continue   # the disk is in-use
    FFREE=${D}; break
  done;
  rm -f $FFREE_OUT
  # double-check there is no problem with using /dev/sd${FFREE} like the disk is already partitioned
  if [ -z "$( kpartx -l /dev/sd${FFREE} )" ]; then
       echo Disk $FFREE is available
   else
       echo No disk is available in /dev/sd{b..i}
       FFREE=;
  fi;
  echo FFREE=$FFREE >/tmp/newdisk.rc
  . /tmp/newdisk.rc
export FFREE

  [ -z "$FFREE" ] && exit

  parted -s /dev/sd${FFREE} mklabel gpt ; RC_1=$?
  PARTED_OPT=""; [ "$OSVER" -eq "6" ] && PARTED_OPT="--align 

Open in new window

0

Scripting Languages

26K

Solutions

20K

Contributors

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.