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

I have been using this power shell command to create a text files that lists the currently installed programs on Windows 10 computers:

Get-WmiObject -Class Win32_Product | Select-Object -Property Name > C:\PCapps.txt

Open in new window


The problem is that this command lists only the names of the installed programs.

I would like to run a command that will display the complete list of everything that is displayed within the Programs and Features applet: Software name, publisher, installed on, size, & version.

What is the correct syntax of a command that will display all this information?
0
Get 15 Days FREE Full-Featured Trial
LVL 1
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Every month I have to go through several text files after paying bills online to send to the CFO to show all the bills that have been paid. I have tried to get him to accept a print of confirmation page but instead he wants it in the format of file 2 below (ee-online-pmts-result.txt). So I copy the results from the web page, past it to a text file and then clean it up removing all the "junk" not needed. As such is there a way I can read the first text file (ee-online-pmts.txt) and then have a list of variables to parse that if found would be removed in such a way that the result will be what the 2nd text file looks like? For instance if  "Print this activity" and two carriage returns (enter, enter) are found it will remove it? Thanks!
ee-online-pmts.txt
ee-online-pmts-result.txt
0
I had this question after viewing Powershell to show mailbox DB .EDB size ?.

Hi,

Can anyone here please assist me in modifying the below PowerShell script to calculate the Exchange Transaction log file size ?

Get-MailboxDatabase | 
    Select Server, 
           Name, 
           @{Name="DB Size (GB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = "`\`\" + $objitem.server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1048576KB; [math]::round($size, 2)}}, 
           @{Name="Number of Mbx";expression={(Get-Mailbox -Database $_.Identity | Measure-Object).Count}},
           EdbFilePath,
           LogFolderPath,
           LogFileSize, 
           CircularLoggingEnabled, 
           IsPublicFolderDatabase | ft -AutoSize

Open in new window


So far it works great, but I cannot get the total Transaction Log size.

Any help would be greatly appreciated.

Thanks,
0
So have 2 different SQL servers, One has a financial database (GP) I need to be able to run a script nightly that takes data from field in a table and copys to the other database.  Basically it would look for data in one field and find the data that needs copied in another field and copy that to the same matching in another database.  Is this something that can be done with a stored procedure?
0
Hello folks,
I need to create a shortcut by using a script batch or PS1 or vbs, I have found this for now but it will not give me a ie
icon

echo start http://www.google.com > "%userprofile%\desktop\Google.cmd"

does anybody has a better solution ?
0
Hi Experts,

I'm looking to create a new user for particular database that will have only limited rights, for example to view only a few tables, and some of those tables only to certain columns.

Also would like to put restriction in some tables that should be able to add/edit only but not delete, and to some only to add, and other tables only read permission.

How would I go about all that?

Is there a script I can have that would allow me to list all those object and particular rights, or perhaps someone can can post some screenshots how do I accomplish that with the SSMS user interface?

Thanks in advance.
0
Hello - I am looking for a script to use within WMI Filtering. The issue is that I have two MSI to deploy from a GPO, however one is a x86 and the other is a x64 version for Office. I need to find out how I can install on proper versions.

I need to be able to query Office 2010, 2013 and 2016 for proper x86 and x64 versions then push proper MSI package to them. I am knew to WMI query language so your help is appreciated.

Thanks,
nimdatx
0
Any input to my batch file would be greatly appreciated

@echo off

xxcopy C:\"Location" E:\Destination /c /s /h /k /bb /tc /yy /BU /PB /X*\temp*\ /oN:c:\tmpxxcopylogs\backup.log

@echo *** Backup Complete! ***

Pause

Open in new window

0
Hi guys.

I wrote a little Bash script (That works together with Some Python Scripts)
to help me manage the number of tickets opened to the system administrators team.

When running the script manually, it works perfectly.

However, when I wrapped it into a service unit and a timer unit, something odd happens.
The script runs - I can see the output in the logs. I can hear the sound alert but I don't see the notify window popping up on the screen.

Here is the bash script:
#!/bin/bash
export DISPLAY=":1"
/usr/bin/kill $(/usr/bin/pidof yad) 2>/dev/null
TTIM=$(/home/david/scripts/tickets.py) # Holds the number of tickets in the mailbox (TIM = Tickets in mailbox)
LTC=$(cat /home/david/scripts/count.txt) #Holds the last ticket count. (LTC = Last Ticket Count)
UTIM=$(/home/david/scripts/utickets.py) # Holds the number of Unread Tickets in the mailbox

if (( $TTIM < $LTC )) # If the number of tickets in the mailbox is lower than the Last Count, update the last count and check for unread mails.
	then
		echo $TTIM >  /home/david/scripts/count.txt
		if ((  UTIM =0 ))
			then
				echo "There are $TTIM in the mailbox COND 1" >> /home/david/scripts/run.log
				/usr/bin/notify-send "There are no new Tickets! There are $TTIM tickets opened!"
				exit 0
		fi
fi
if (( $UTIM > 0 )) #If there are any unread tickets, throw the message anyway!
	then
		echo $TTIM >  /home/david/scripts/count.txt
		/usr/bin/aplay /home/david/scripts/1.wav;
		echo "There are $TTIM in the mailbox 

Open in new window

0
Folks,
I have created the following batch script
For /f %%a in (Clients.txt) do (
 psexec \\%%a cmd /c reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version>>report2.csv
 IF %ERRORLEVEL% EQU 0 @echo %%a>>report.csv
)

Open in new window


However my report shows, version information on top and then PC name at the bottom a bit messy ... what do you guys think i should change in order to make the result, two columns one for PC NAME and next column VERSION. or any better suggestions? [including powershell ]?

Thanks for looking
0
Ready to get started with anonymous questions?
LVL 9
Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

I'm having difficulty with a PowerShell Script.

If I use this line:
icacls c:\mytest\ /grant '"mytest":(OI)(CI)f /t'
it works fine.

However, I'm using the script to process data from a CSV file, so I need to be able to use variables.

I've tried many variations of this line:
icacls c:\$TestName\ /grant '"${TestName}":(OI)(CI)f /t'
but each variation generates some type of error (mostly OI : The term 'OI' is not recognized as the name of a cmdlet, function, script file, or operable program...)"

Any guidance would be greatly appreciated.
0
Hello,

I am wondering if there is a way to automate (through script) the steps on this article?  
Thank you in advance!
0
Hello,

I am trying to see if there is a way to create a bat file to add the highlighted features below. This is for a Windows Server 2012. Thank you for your help!
Features.JPG
0
Hi All i have this file which i want to convert to csv very simple i just need all the columns.

Account Number  &  Name                   Telephone No.   Contact          Credit Limit               Last Cash  Branch/Ref/Type   Date   Due Date Order Number             Current      30-Days      60-Days      90-Days     120-Days     150-Days   STE  Balance                 Unapplied

I have attached the file.

Thank you for your help
AR070717.txt
0
*I was tasked with writing a script (suggested in python but can be anything that the Crontab will work with) but my programming skills are definitely lacking. In the past week I have been researching and trying to learn as much as I can and below is what I came up with but I could use some help from the EE community. Thanks!

I am trying to write a script in python that will run on our Crontab of our Linux VM server. The script is supposed to recursively go through all the files on the remote server directory and download the specified file type (.csv in this case) and then promptly delete whatever files successfully download from the server. I have the following code using pysftp but I am open to using other modules such as paramiko or lftp if it's easier. It just needs to be able to be run as a Cron job in our Crontab on the linux server.

Below is my current code but it isn't work in terms of remotepath, localpath. I tried to tell it to download the file to a certain path but it's not going there. Also I don't know the command to remove the files it downloaded only. In other words files might already be on the local server and if so they should NOT download so that means the file wouldn't be removed from the remote server (if it doesnt download it shouldn't get removed).

For security purposes I have removed the server info. I did create a public/private key for ssh but unsure of how to implement it into my code.

import pysftp
import sys
import glob

srv 

Open in new window

0
Hi Experts,

I have this script tested and works as expected to report back local drives presented to windows OS. However I need your help to improve this or have completely new script to achieve this;

get drive letter of the disks on the  server;
create a .txt file with the drive letter name ( such as "D drive.txt")  
AND save it into the each disk  with its drive letter name

For an example, if four disk found as D, E,Y,S on a local server, after running the script,  when I  go into each disk, I should have a .txt file saved in there as D drive.txt, E drive.txt , Y drive.txt and S drive.txt

batch script will be used on  mixture Windows OS versions. ( 2003 to 2012)
is possible to achieve this?
markerfile.txt
0
Hello All, I have this .bat for change expiration date of users in a .csv file, but I decide which date I want to put.

Now, How can I change that the date will to NEVER?

[b]@echo off
setlocal

:: *** csv-File with the name, first name, and user name:
set UserFile=\\Srv_\publico\DATOS\Procedimiento\Procedimientos\prorrogarUsuario\prorroga.csv

:: *** Distinguished Name of the container to add the new user to:
set UsersDN=OU=Usuarios,OU=UsuariosCM,OU=CM,DC=D,DC=domain,DC=com

for /f "tokens=1-4 delims=," %%a in ('type "%UserFile%"') do (
  set Userp=%%a
  set Date=%%b
  call :process
)
goto :leave

:process
set USER=%Userp%

echo Prorrogando usuario
echo Username: %USER% date: %Date%

echo.
:: ***echo Hit ^<ctrl-c^> to stop, any other key to create the user.
:: ***pause >NUL
echo.

:: *** Test mode: Remove the "ECHO" in front of the following line to run the script for real:
net user %USER% /expires:%Date% /DOMAIN

:leave[/b]

Open in new window


Can u help me?
0
Hi Experts,

I'm creating a table of users passwords and would like to ensure each password contains at least one digit, one uppercase and one lowercase letter, how do I check for that within a string?
0
Hi

Can anyone in assist me in doing the following:-

1. Check the presence of an e-mail e.g. Cognos Start Success Message, if not found within a time period e.g. 4hr, report to a log file as Cognos Start Success Message not found.  If found then look for an e-mail 'Cognos Finish Success Message, if not found within a time period e.g. 5hrs report to a log file as Cognos Finish Success Message not found.
0
Setting up LaraDock for Laravel
Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

I have a script that pulls attributes from a csv, I also have it outputting two groups.  I recently came across a problem where Get-ADGroupMember only pulls up to 5,000 users in these groups.  Is there a parameter to get around this?  Here is the script I have:

$GroupAmembers = Get-ADGroupMember "O3651" | Select -ExpandProperty DistinguishedName
$GroupBmembers = Get-ADGroupMember "O3652" | Select -ExpandProperty DistinguishedName
Import-Csv -Path c:\temp\input.csv | ForEach-Object {
	Get-ADUser -Filter "(sAMAccountName -eq '$($_.sAMAccountName)')" -Properties userPrincipalName, sAMAccountName, DisplayName, distinguishedName | Select-Object userPrincipalName, sAMAccountname, DisplayName,distinguishedName, @{n="O3651";e={$GroupAmembers -contains $_.DistinguishedName}},@{n="SO3652";e={$GroupBmembers -contains $_.DistinguishedName}}
} | Export-CSV C:\Temp\mailusers.csv -NoTypeInfo

Open in new window



Any help is appreciated
0
The script below does a count of the existing folders and if the count is different the next time it runs then it will generate an Event ID. The problem that I have with the existing approach is that when a folder is purged/deleted the count is no longer valid and we will be a false positive.

Instead of the .count we need to find if a new folder has been created. I am not sure if there is a way to do it by date? or some other way so that when folders are deleted we don't get falser positives.

Basically the goal is to have a script which will run from SCOM the target machine (every 30 min) to verify if a new folder has been created in a specific path, if so then will generate an event ID. SCOM will monitor the event-id and generate an alert.

The script below works great, but we need to replace the count with something that will be more date oriented.

Thank you!

---------------

#requires -version 3
New-EventLog -LogName Application -Source "MyScript" -ErrorAction SilentlyContinue
$basecountfile = "$env:HOMEDRIVE\scripts\basecount.txt"
if (test-path -Path $basecountfile){
  # if file not found then this is the first run so there is no baseline
  # otherwise check the path and count the directories and compare against the baseline
        $previouscount = get-content -path $basecountfile
        $basecount = (get-childitem -Path \\server\folder -Recurse -Directory).count
        if ($basecount -ne $prevouscount) {
        # found a difference
         

Open in new window

0
Hi ,

I am trying to use HTA with VBScript and Excel for Task list tracking and have done everything with excel protecting with password. Now I want to convert with HTA file to .exe file and package the excel along with it. Is there any way with VBScript to open file without giving full path in the code. I am new to scripting and a help is highly appreciated.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("D:\Projects\Tracker.xlsx",,,,"xxxx")
Set objsheet = objExcel.ActiveWorkbook.Worksheets(1)

Regards,
Maha.
0
Hi all,

Bit of a strange one this and I wont try and explain the reason I need this as its pretty long winded!

I would like to try and create a logon script, which when triggered executes a wake on lan command (which references a MAC address, ideally in a .csv list or similar) based on which user is logging on.  I hope that makes sense!

Example

User "STEVE" logs on

1.) Logon script is executed

2.) WOL command is triggerd and looks to a CSV file to match up "STEVE" to Mac address 11:11:11:11:11:11

User "DAVE" logs in

1.) Logon script is executed

2.) WOL command is triggerd and looks to a CSV file to match up "DAVE" to Mac address 22:22:22:22:22:22

Would anyone be able to help me achieve this please?

Thank you
0
I want to do a backup with robocopy for 3 folders would the flowing be the right way to do it?

robocopy
f:/ data \\DC2\Backup /mir /r:1 /nfl /ndl /copyall
f:/ clientdesktops \\DC2\Backup /mir /r:1 /nfl /ndl /copyall
f:/ clientdocuments \\DC2\Backup /mir /r:1 /nfl /ndl /copyall
/log+:f:\Reports\robocopy.txt
0
I've never used Powershell to run scripts before so be gentle, this scripting stuff is very new to me :)

I just copied what I thought would be a very handy script from a Microsoft article that I saved as PatchScript.ps1, but when I try to run it in Powershell, I get the error:

File C:\1\patchscript.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:21
+ c:\1\patchscript.ps1 <<<<
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

I looked into signing and it seems like such a long winded process to go through just to run the occasional script I'm confident will be safe, so was wondering if there is an over-ride of some sort to run an occasional self created script?  

Or is there an easy way to temporarily disable the policy preventing the execution of scripts, and then re-enable that policy immediately afterwards to maintain the security that it provides?

Your help would be appreciated.
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.