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

Can you recommend any resources/tutorials to learn Autosys R11? I have to learn how to create autosys jobs including jil files.
0
Containers & Docker to Create a Powerful Team
Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Hello -

I am trying to uninstall Symantec Endpoint Protection and replace with new AV within SCCM 2012. I have the install application for Symantec and new AV. The Symantec application should have a uninstall switch, however not sure how to double check that with .exe I have for Symantec. I have tried to run uninstall of Symantec with Uninstall.exe however no luck. I have also tried to run a batch file from my desktop with wmic product where "name like 'Symantec Endpoint Protection%'" call uninstall /nointeractive, however no luck.
0
Hi All,

Greetings...

According to my work, I need to zip files present in a folder using batch script without using any 3rd party software.

I tried with below code ,but getting the error.error also attached below.

Any help regarding this would be highly appreciated.
'Get command-line arguments.
Set objArgs = WScript.Arguments
Set FS = CreateObject("Scripting.FileSystemObject")
InputFolder = FS.GetAbsolutePathName(objArgs(0))
ZipFile = FS.GetAbsolutePathName(objArgs(1))

'Create empty ZIP file.
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)

Set objShell = CreateObject("Shell.Application")

Set source = objShell.NameSpace(InputFolder).Items

objShell.NameSpace(ZipFile).CopyHere(source)

'Required!
wScript.Sleep 2000

Open in new window


This code is present in zip.vbs file. We have to zip the files into Outputfile.zip file.
in command prompt  , I have entered below command

C:\Users\abc>Cscript zip.vbs input path  output path\OutputFile.zip

While executing this ,I got below error. " Path not found error" for both the input and output file path.

It will be helpful if anyone corrects me the mistake which I made in this script.
2
i'll need a Shell script that scans thru creation dates of all patches (ideally only the security ones but
if this is not possible, then all patches) installed in an RHEL 7 server, get the latest one, compute
the difference from today's date & give the difference in number of days & if the difference is
more than 90 days, echo out a message, "It has been more than 90 days since last patch)

Purpose is to check the last patch date & remind Linux admins.  Believe RHEL releases patches
at least every 3 monthly?
0
I have a roadblock where I could not bypass the Banner message appears while connecting over RDP...

$Server = 'Server1'
$wshell = New-Object -ComObject WScript.Shell
$wshell.run("Mstsc")
Start-Sleep 1
$wshell.AppActivate("Remote Desktop Connection")
$wshell.sendkeys("$Server")
$wshell.sendkeys("{ENTER}")
sleep 30 ----------------------------------------->>>> at this stage, I can see it is connected to remote server and banner message is being shown.
$wshell.AppActivate("Server1 - Remote Desktop Connection")
$wshell.sendkeys("{ENTER}")

I have tried all the modules/functions found over google but did not help...  when I try the same thing through WinAutomation and Devolutions Remote Desktop Manager, it is working fine.. any clue why and any solution ?
0
Is it possible to write a script / powershell to

1. Unlock the bitlock portable driive and save files/folders into it
2. lock the bitlock portable
3. send email to inform the completion.

The folder is created with multi-language (not pure English). Alternatively, any free tools will also be considered.

Thx
0
I had this question after viewing Modifying PowerShell to list some Event logs with certain username ?.

People,

I wonder if it is possible to modify the below PowerShell script to dump all information from the Event ID 4625 ?

The below script was created by one of the experts here but it is just for Event ID 4624.

$LogonType = @{
	[uint32]2 = 'Interactive'
	[uint32]3 = 'Network'
	[uint32]4 = 'Batch'
	[uint32]5 = 'Service'
	[uint32]7 = 'Unlock'
	[uint32]8 = 'NetworkCleartext'
	[uint32]9 = 'NewCredentials'
	[uint32]10 = 'RemoteInteractive'
	[uint32]11 = 'CachedInteractive'
}

Get-ADComputer -LDAPFilter "(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))" | ForEach-Object {
    "Processing $($_.DNSHostName) ..." | Write-Host
	Get-WinEvent -ComputerName $_.Name -FilterHashTable @{LogName="Security"; ID=4625; Data="FirstName.LastName"} -MaxEvents 100 | ForEach-Object {
		New-Object PSObject -Property ([ordered]@{
			MachineName = $_.MachineName
			TimeCreated = $_.TimeCreated
			User = $_.Properties[5].Value
			Domain = $_.Properties[6].Value
			LogonType = $_.Properties[8].Value
			LogonTypeString = $LogonType[$_.Properties[8].Value]
			SourceIP = $_.Properties[18].Value
			SourceName = (Resolve-DnsName -Name $_.Properties[18].Value -ErrorAction SilentlyContinue).NameHost
			Keywords = $_.KeywordsDisplayNames -join ";"
		})
	}
} | Export-Csv -Path C:\TEMP\User-LockedOutSource.csv -NoTypeInformation -UseCulture

Open in new window


More Information about Event ID: 4625: https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=4625
0
People,

I need some help to query all domain controller for certain Security Event ID like: 4740, 4771 and 4776.
My goal is to know which location of the Locked AD account.

This is the script that I have and been working:
$LogonType = @{
	[uint32]2 = 'Interactive'
	[uint32]3 = 'Network'
	[uint32]4 = 'Batch'
	[uint32]5 = 'Service'
	[uint32]7 = 'Unlock'
	[uint32]8 = 'NetworkCleartext'
	[uint32]9 = 'NewCredentials'
	[uint32]10 = 'RemoteInteractive'
	[uint32]11 = 'CachedInteractive'
}
Get-ADComputer -LDAPFilter "(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))" | ForEach-Object {
    "Processing $($_.DNSHostName) ..." | Write-Host
	Get-WinEvent -ComputerName $_.Name -FilterHashTable @{LogName="Security"; ID=4624; Data="John.Wick"} -MaxEvents 200 | ForEach-Object {
		New-Object PSObject -Property ([ordered]@{
			MachineName = $_.MachineName
			TimeCreated = $_.TimeCreated
			User = $_.Properties[5].Value
			Domain = $_.Properties[6].Value
			LogonType = $_.Properties[8].Value
			LogonTypeString = $LogonType[$_.Properties[8].Value]
			SourceIP = $_.Properties[18].Value
			SourceName = (Resolve-DnsName -Name $_.Properties[18].Value -ErrorAction SilentlyContinue).NameHost
			Keywords = $_.KeywordsDisplayNames -join ";"
		})
	}
} | Export-Csv -Path C:\TEMP\John.csv -NoTypeInformation -UseCulture

Open in new window


and this is the second PowerShell script:

get-eventlog -logname "security" | where {($_.eventID -eq 4771) -or ($_.eventID -eq 4776) -or ($_.eventID -eq 4625) } | select timegenerated,message

Open in new window


Any help would be greatly appreciated.
0
So long story short I think it MAY have something to do with my shebang in my python. I know on our server we have a few different versions of Python and I installed my modules (paramiko and pysftp) in the correct place I believe. Honestly I have researched and am having trouble understanding how exactly the shebang works and knowing what interpreter it is pulling from or why the cron job is failing for that script (is there a log file perhaps to help determine the cause?)

Cron listing:
* * * * * /usr/local/mlb_cdt_download_newv2.py > /dev/null 2>&1
(Yes for testing purposes I am trying to have it run every minute just to see if it runs)

Script:
#!/usr/local/lib/python2.7
import os
import pysftp
import os.path
import paramiko

HOST=""
USER=""
PASSWORD=""
SUFFIX_TO_FETCH__AND_DELETE=".csv"
DESTINATION_PATH="/mnt/sas/ftp_mlb"

srv = pysftp.Connection(host=HOST, username=USER, password=PASSWORD)

def do_nothing(fname):
        return  " "

def fetch_and_remove(fname):
    if not fname.endswith(SUFFIX_TO_FETCH__AND_DELETE):
        return # skip files with wrong suffix
    dst_fname = os.path.join(DESTINATION_PATH, fname)
    dst_dirname = os.path.dirname(dst_fname)
    if os.path.isfile(dst_fname):
        return " "
    else:
        srv.get(fname, dst_fname)
        srv.remove(fname)

srv.walktree('.', fetch_and_remove, do_nothing, do_nothing)

srv.close()

Open in new window


For the record, running this script from the commando line works instantly and perfectly. But when trying to automate it through the cron I have no luck.

Any help trying to understand which interpreter my cron is trying to use and the location of such would be greatly appreciated.
0
I am looking for few things to be automated in AD- through script or any other better available solution

1.To Send email notification after AD user creation
2. To send reminder Email on password expiry  (before 1 Day, 10 Day's, 20 Day's)
3. Generate password automatically  and then send it on email

Thanks in Advance for prompt support .
0
Monthly Recap
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Hey Scripting Guys, how can i list all the duplicate files in a folder and sub folder with there file name, paths and size. I have couple of million files on a E drive of a windows server 2008.
For audit reasons, I cannot delete the original file however duplicate can be deleted. my plan is to move those files to external tape for a backup for next few months to avoid any issue.
 
So, part 1 - finding duplicate files ( file can have same name or same name with date as for example text01011992, problem is the same file can be saved by the user with multiple name ...hence need a wild card to handle this) and finally, exporting the data into csv or excel

Part 2- deleting them

Rule - part 1 and 2 can't be merged.

so far - i have below script
ls *.* -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group | select -skip 1 } | echo
ls *.* -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group | select -skip 1 } | del
0
Greeting Experts,

I have a script that works w/o any problems as is but I need to add an email function that will allow it to send email in the event a website is not blocked. The way the script works (see below) is checked to see if status code of each site ( i.e. -eq 200) and checks to see if can be reached or not. Verify if our content controls are working or not. If it's blocked, then it will come back with "Site it blocked: URL, " or if not blocked then you will get "Site is not blocked at this time: URL."   I am looking to add an email function to the script to alert me and others in the case a site pops up as not blocked. Can somebody help me update this text ... thanks

$objXmlHttp = New-Object -ComObject MSXML2.ServerXMLHTTP
$URLlist = Get-Content "C:\FileLocation\List.txt"
Foreach($url in $URLList) {
    $objXmlHttp.Open("GET", $url, $False)
    $objXmlHttp.Send()
    $content = $objXmlHttp.responseText
    $status = $objXmlHttp.status
    $statustext =$objXmlHttp.statusText
    if ($status -eq 200) { 
        Write-Host "Site is Not blocked at this Time: $URL" 
    }
    else {
        Write-Host "Site is blocked: $URL "
    }
}

Open in new window



Output from Script:

Site is blocked: http://www.playboy.com 
Site is blocked: http://www.gambling.com 
Site is blocked: http://www.zob.com
Site is blocked: http://www.gmail.com
Site is blocked: http://www.dropbox.com
Site is blocked: http://www.facebook.com
Site is blocked: http://www.Twitter.com
Site is blocked: http://www.snapchat.com
Site is Not blocked at this Time: http://www.skydrive.com
Site is Not blocked at this Time: http://www.hotmail.com
Site is Not blocked at this Time: http://www.outlook.com

Open in new window

0
I want to import a huge number of very small text files (content is 1 line per file) parse the line and convert it to another text file using delphi. Using the simplest assign(f) etc approach will take several weeks to execute. The bottleneck might probably be the opening/closing of each file. Is there any other way of doing this a lot faster?  maybe using another scripting language? which one?
0
Every month  we wud like to sftp over  Win 7 n Win 10 patches (.msi  .msu, ??)  to about 20 remote PCs that are located in our supplier/service providers premises as these PCs are npt part of our corporate's AD/domain n we cant Rdp/remote to them for security reason.

Can anyone provide a batch or cmd scripts tt will scan for the presence of msi or msu (or any extensions tt MS patches may come in) in a folder (say c:\MSpat )  n will execute them in silent mode (ie dont need us to input/intervene) but dont reboot after patching.  Ideally, output logs ( >>) or error ( 2>>) to 2 separate logs.  Housekeep away the patch files
0
how to find row count of each file of the file type .ref across multiple folders in command prompt and send the output to output.txt file
0
I am pretty familiar with scripting on LINUX.  However I am not familiar with every command LINUX has.

I need to be able to query the Windows AD and retrieve the following information:
Username, Full Name, UID, Last Change, Minimum password age, maximum password age, warning in days before password expires, is the account disabled, account expiration.

Can this even be done?

Thanks,
John
0
Dear experts,

I'm newbie to scripting so as always your help and time is very appreciated.

on source infrastructure : I have server1 on domain A with lots of local groups. all these local groups on server1 has domain groups and user members. it is a standalone windnows 2003 server.

on target infrastructure: I have domain B with windows 2012 server.

findings: I found below script on TechNet but slightly confused about copying nested members or group members to target DC. I could not understand on which line it is copying  group members to domain B domain Controller after creating Universal or Domain Groups on Domain controller. Surely, created groups must have their members.  

https://gallery.technet.microsoft.com/scriptcenter/Migrate-local-file-server-7732203a#content

task completed: I used basic bat file on source server to get local groups and their members. For an example:  net localgroup "Administrators" >> GroupMembers.txt   this gave me the outcome I need but it I need to sort it correctly so that when I use it to import the outcome sorting should be easy to collect for the PowerShell mentioned in the link. I did NOT use POWERSHELL on Source Server.

question: I need to move all the local groups and their members from server1 domain A to Domain B Doman controllers so all groups are domain based groups instead of local groups as it is now in domain1 on Server1. Is this possible to achieve this with the script found in the below link? Is there any …
0
Hi I have a  data like below format

Site	Variable	Units	Model	29/00Z	29/06Z	29/12Z
CQT	500mbHeight	dm	MASS	588.4	589 	588.9
CQT	500mbHeight	dm	NAM	589.4	589.5	588.2

Open in new window


How can i transpose as one below (like repeat first 4 columns for transpose of each row after 4th column
CQT	500mbHeight	dm	MASS	29/00Z	588.4
CQT	500mbHeight	dm	MASS	29/06Z	589
CQT	500mbHeight	dm	MASS	29/12Z	588.9
CQT	500mbHeight	dm	NAM	29/00Z	589.4
CQT	500mbHeight	dm	NAM	29/06Z	589.5
CQT	500mbHeight	dm	NAM	29/12Z	588.2
CQT	500mbHeight	dm	NAM	29/18Z	589.6

Open in new window

0
I'm using ASE to create SCR and KiX script files. When I create a VBS or Bat file it allows me to use the Active Debugger that highlights each line of code as I step thru the script and can also watch the variables change. But when I create SCR or KiX scripts it only gives me a DOS window style debugger (see attached). Is there a way to make it use the Active Debugger when debugging SCR and KiX script files?
ASE-DOS-Debugger.png
0
On Demand Webinar: Networking for the Cloud Era
LVL 9
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Hello Folks,

I have scripted a few apps to be installed among them I need to remove and old version of Flash therefore I have this file:
uninstall_flash_player.exe
so I'm using this line
uninstall_flash_player.exe -uninstall plugin

Open in new window

I have also used this line
start /wait uninstall_flash_player.exe -uninstall plugin

Open in new window

and this one
uninstall_flash_player.exe -uninstall

Open in new window


All the other applications I could install while triggering them w/ psexec, except for flash uninstall. it just stays still with the cursor blinking...
If i was to install it local then it would work, My ntid is part of the local group

Update:
so part of my script is like this:
if i do
start /wait c:\apps\uninstall_flash_player.exe -uninstall -force

Open in new window

then it would work but now im asking myself how come the other apps don't need the location since i'm launch the batch form the same folder as the script...?

any suggestions?
0
Hi People,

Can anyone here please share the PowerShell script for Exchange Server 2013 Mailbox Export to PST (one at a time to avoid server load issue)?

What I'd like to achieve:

1. The input from .CSV file or Excel Spreadsheet based on Firstname Lastname on column 1
Employee Name
John Smith
Matthew Porter
Qun Hin
Xan Vao
...

2. Export it as the same emailaddress.PST name format
3. limit the export to be just one at a time
4. send email when the export finish.

Thanks in advance.

I've read this website: https://technet.microsoft.com/en-us/library/ff607299(v=exchg.150).aspx but there is no
0
HI Guys,

 I need a powershell script to give me information on all the servers in our environment, the information I need are:

Server Name
OS Service Pack
DNS Domain
Disk Space (GB)
IP Address
MAC Address

what is the best way to achieve this?

Thank you in advance,
Kay
0
Powershell command to list the information under Active Directory Tabs
In Active Directory, we have default tabs for AD objects(users and computers). We also have Customized tabs, that have been created by developers.
I would like to have a Powershell command that will give me information under  AD object (user or computer) tab, instead of manually searching for the object in AD and looking at the properties.

example, if I need to find a Canonical Name of Object under Object tab, I will need just to run Powershell command

Any help will be very much appreciated.

Thank you
0
Hello,
I have powershell code for winscp that uploads files from a local directory using a filter on files in the directory to a remote server.  I need code to determine if files are in use before they are uploaded. If a particular files is in use, I would like the code to skip the upload of that particular file and continue with the upload of the files not in use.  The code needs to accommodate applications that might be using the file that do not support file handles and any process that might have a lock on the file.

Any help would be greatly appreciated.

Thank you
Diammond
0
Hi Friends,

how to get only user name (domain username) below mentioned VBscript. if any possible please help me.

On Error Resume Next
Dim fso, ts
strOutput = "Local_status.csv"
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set input = fso.OpenTextFile("F:\serverlist.txt", 1, False)
Set ts = fso.CreateTextFile("F:\Local_status.csv")
fv = "File Version"
ts.WriteLine """ComputerName"",""GroupName"",""User Name"",""Type"",""Description"""

While Not input.AtEndOfStream
      strComputer = input.ReadLine
      Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
For Each objGroup In colGroups
    If LCase(objGroup.Name) = "administrators" Then
        For Each objUser in objGroup.Members
              strUserPath = objUser.aDSPath
                  strUserPath = Replace(strUserPath, "WinNT://", "")
                  Pos         = InStr (strUserPath, strComputer)

                  If Pos > 0 Then
                        strUserPath = Mid(strUserPath, Pos)
                  End If
'                  WScript.Echo strUserPath
            ts.WriteLine """" & strComputer & """,""" & objGroup.Name & """,""" & strUserPath & """,""" & objUser.Class & """,""" & objUser.description & """"
        Next
    End If

Next
     
     
Wend

input.Close
ts.Close
Set ts = Nothing
Set fso = Nothing


MsgBox "Done. Please see " & strOutput
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.