Scripting Languages

28K

Solutions

21K

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

ReactReduxCodeFile.rtfI'm a total react/redux newbie; I have a react/redux app that loads a page based on 2 sets of select boxes; When user makes selection, the dispatch event happens and immediately a spinning loader icon is displayed which displays until all the data is loaded. Somewhere in the attached file code, that part is not working. Any help is appreciated.
0
Why Diversity in Tech Matters
LVL 13
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Hi Experts,

I've been working on this powershell script and need some help with a couple of things.  The script will be called from this vbscript to pass the computername or listofcomputers variables.

What I'd like expertise or help with is:

1. I've tested calling this from the VBScript Code in top comments section, but didn't get the computername variable to pass down.  (this would be done from the vbscript above, but wanted just a test wrapper to test).  EDIT:  If this is too difficult, I'd like to set it up to pull from a list of computers.

2. I'm first running "Test-MyConnection" (if) the computer is online, I'm then calling a executable.exe.  This is the part I'm having issues with - I don't necessarily want to run a .exe here, but call an SCCM advert (pasted below from client center), or, I also have a vbscript that runs the advert I could call out to.  This advert would exist locally on every computer.  The part I'm unsure about, or how to code is having this advert run on each computer in the list of variables


SCCM Advert Code:
 get-wmiobject -query "SELECT * FROM CCM_Scheduler_ScheduledMessage WHERE ScheduledMessageID='SCCM00001-SCCM00002-5D2960FE'" -namespace "ROOT\ccm\policy\machine\actualconfig"
 

Open in new window

0
Exchange 2013 delete deleted items , permanently. via power shell
0
We are trying to implement the Win 10 1809 STIG. Several of the checks in the STIG use Get-ProcessMitigation -Name PROGRAM.  Several checks are failing due to the PS command error below:
Get-ProcessMitigation -Name Acrobat.exe
Get-ProcessMitigation : Requested registry access is not allowed.
At line:1 char:1
+ Get-ProcessMitigation -Name Acrobat.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ProcessMitigation], SecurityException
    + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.Samples.PowerShell.Commands.GetProcessMitigationCommand

Open in new window

However, the following runs fine:
Get-ItemProperty -path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Acrobat.exe'

DisableExceptionChainValidation : 0
MitigationOptions               : {1, 1, 33, 0...}
MitigationAuditOptions          : {0, 0, 0, 0...}
PSPath                          : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Acrobat.exe
PSParentPath                    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
PSChildName                     : Acrobat.exe
PSDrive                         : HKLM
PSProvider                      : Microsoft.PowerShell.Core\Registry

Open in new window

Get-ProcessMitigation -system also runs fine.  Get-ProcessMitigation without the -name is suppose to return all the program values, however that has the same registry error.  We are having a hard time trying to figure out how to fix this so we can get accurate results.
1
Trying to accomplish the following, oBdA provided me with the process script, but I'd like to build on it.  If anyone can help, it would be greatly appreciated!

Have a powershell script that can be called from a vbscript and pass the parameter defined in the vbscript to the powershell script. In vbscript, I can call with this code, but not sure how to pass the parameter (computer) for example defined in vbscript...
'Set objShell = CreateObject("Wscript.Shell")
'Objshell.Run("powershell.exe -noexit .\test.ps1")

Open in new window

Powershell Script I'd like to do a few things:
• Check if the computer is online or offline.
• if computer is is offline, exit and send an email
• if the computer is online, run the below script that will check for running processes.
• if the below has anything other than return code 0 (meaning process is still running), have send email
• if the below has a return code of 0 (meaning no processing running), run an executable and invoke some SCCM commands.
 $computerName = 'RemoteMachine' ## Set to $null to run locally
$processList = @'
    "Name",             "Expected",     "Running"
    "cmd",              "1",            "0"
    "powershell",       "1",            "0"
    "OfficeClickToRun", "2",            "0"
'@ | ConvertFrom-Csv | ForEach-Object {$_.Expected = [int]$_.Expected; $_}

$splat = @{}
If ($computerName) {
    $splat['ComputerName'] = $computerName
    Write-Host "Testing processes on $($computerName)" -ForegroundColor Yellow

Open in new window

0
Powershell Enter-PSSession no longer working. Recently I started using the PowerShell command Enter-PSSession to run several commands on some remote PCs.

My workstation runs Windows 10 Pro, and the target computers all run windows 7 Pro this is in a domain environment and I'm doing this with admin credentials. It worked at first, but recently I've started getting an error whenever I try to run the Enter-PSSession command as shown in the attached screenshot.
screenshot of errorother users with the same permissions as myself do not get this message and are able to use Enter-PSSession without trouble.

Is it possible to somehow reset my PowerShell preferences/settings back to default and remove any extra modules I may have installed that could have caused this?
0
What would be the query (Script) to drop all synonyms in corresponding databases in entire instance as a bulk?

The report ( csv file) looks like this. I want to drop them all by base_object_name


DB_name               Database_id     object_id                    base_object_name

[ABSCorxxxOM]      39                         NULL                              [fwbsqerewe2].[ABSCorxxxOM].[dbo].[DealMaster]
[ABSCoyyyyOM]      35                         NULL                              [fwbsqerewe2].[ABSCoyyyyOM].[dbo].[TrancheMaster]
[A.ROM]                    40                         NULL                              [fwbsqerewe2].[A.ROM].[dbo].[Static_UserDirectory]
[As3.Ms.Import]      92                         NULL                              [sg-nt].[As3.Ms.Import].[dbo].[Static_InterfaceTransformSequence]

and ........
0
Hi

Can you please help me to save log into csv?

Script works but i am having problem to save output to csv.

I  would like to add to this script another variable to copy missing files from source to destination server\directory

$folder1 = "C:\Folder1"
$folder2 = "C:\Folder2"

# Get all files under $folder1, filter out directories
$firstFolder = Get-ChildItem -Recurse $folder1 | Where-Object { -not $_.PsIsContainer }

$failedCount = 0
$i = 0
$totalCount = $firstFolder.Count
$firstFolder | ForEach-Object {
    $i = $i + 1
    Write-Progress -Activity "Searching Files" -status "Searching File  $i of     $totalCount" -percentComplete ($i / $firstFolder.Count * 100)
    # Check if the file, from $folder1, exists with the same path under $folder2
    If ( Test-Path ( $_.FullName.Replace($folder1, $folder2) ) ) {
        # Compare the contents of the two files...
        If ( Compare-Object (Get-Content $_.FullName) (Get-Content $_.FullName.Replace($folder1, $folder2) ) ) {
            # List the paths of the files containing diffs
            $fileSuffix = $_.FullName.TrimStart($folder1)
            $failedCount = $failedCount + 1
            Write-Host "$fileSuffix is on each server, but does not match"
        }
    }
    else
    {
        $fileSuffix = $_.FullName.TrimStart($folder1)
        $failedCount = $failedCount + 1
        Write-Host "$fileSuffix is only in folder 1"
    }
}

$secondFolder = Get-ChildItem -Recurse $folder2 | Where-Object { -not 

Open in new window

1
A Script to add a new tab and field in Active Diretory Object Properties

I have Active Directory in LAB environment. I would like to add new tab with Fields under the tab.

Example the tab wil show as "Employee Info" , and under the tab , I will see fields such as Employee ID , Date of Hire, etc....

Thank you
0
I am trying to build a query for Great Plains Dynamics but am running into some issues and cannot figure out why--I think it may be due to the JOIN commands I am using. When I do a search for a record for which I now there is only one I end up with 100's and 100's of query results, or errors so not sure what I am doing wrong. Here are the tables I need info from
SOP10100 is the Shipping Address Table
SOP10106 is the Shipping Details Table
SYO1200 is the email table
RM00102      MAIN Customer Info and ADDRESS Table

SOP10106 tied to SOP10100 by SOPNUMBE
SOP10100 tied to RM00102 by CUSTNMBR
RM00102 tied to SYO1200 by ADRSCODE

This is the script I generated using the SQL Server Enterprise Manager graphical "query" feature. This script does not generate any errors when I run it in SQL Enterprise Manager -- I know there is only one record that meets the criteria and yet it show more than 100 results. But when using SQL Query Analyzer I get these errors
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'SOP10106'.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'SOP10100'.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'RM00102'.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'SY01200'.

Here is the script generated and used
SELECT SOP10106.SOPNUMBE, SOP10100.SOPNUMBE AS SOPNum, RM00102.CUSTNMBR, RM00102.ADRSCODE, SY01200.ADRSCODE AS ADRCOD, SOP10100.CUSTNMBR AS CSTMRNO

FROM SOP10106 INNER JOIN …
0
Learn SQL Server Core 2016
LVL 13
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Using Google Sheets where column D contains a list of email addresses previously in use. In comes a new email containing basically the same list of emails, but potentially with some additions which I then add to the bottom of my sheet in column D.  What I want to do now is highlight all the newly pasted emails that are not in the original list above. The first list is D2:D226 and the new list is D228:D270.  Items in D228:D270 should be highlighted if they are duplicates so that I can remove them.

The instructions on this page https://stackoverflow.com/questions/21899516/how-to-highlight-cell-if-value-duplicate-in-same-column-for-google-spreadsheet say to do the following.

Select the whole column
Click Format
Click Conditional formatting
Click Add new rule
Set Format cells if to: Custom formula is:
Set value to: =countif(A:A,A1)>1
Set the formatting style.
Ensure the range applies to your column (e.g., A1:A100).
Anything written in the A1:A100 cells will be checked, and if there is a duplicate (occurs more than once) then it'll be coloured.
For locales using comma (,) as a decimal separator, the argument separator is most likely a semi-colon (;). That is, try: =countif(A:A;A1)>1, instead.

I don't fully understand the syntax to be used or how to implement it. Assistance is greatly appreciated.
0
Free code sharing solution with edit history

I am looking for a free codesharing solution with edit history.  The service here is fantastic https://codeshare.io/GLDjbk. However, it allows anyone with the link to edit, doesn't provide edit history, and they start charging if you want to protect the code that you have written.

The language I am using is gscript based on Java and C#, but I would like to be able to put in any kind of code at all, even something not recognized.

Assistance in finding a better solution is greatly appreciated.
0
Hi Experts,

I,ve a cmd to viewing my application running status in Linux, this is a manual process, i need to run same process using script file ?

Please Suggest.
Proc.jpg
0
Need to Push Power shell upgrade on Dc and domain Servers  running with win 2008,2012
what should be standard  PS version ?
What all are prerequisites before we  Plan the upgrade ?
Any risk upgrading Power shell @Win 2008 ?

Can We Push it in a way to get this updated on all servers  n domain?

Thanks
0
To Achieve it..we ..
Need to Locate  Dynamic DNS entries of servers which are alive but for which the DNS entry was not updated for 30-40+ days.
Need to Locate Static DNS entries of server which are no longer existing.

Please help if this can be automated using script or utility  and will there be any Risk /Prerequisites of backup before we enable Scavenging
0
Include a script in SCCM Task Sequence

This scenario is about deploying WIndows 10  OS using USB drive Boot.
The OS is to be deployed for different floors. The issue is joining the computer to the domain automatically with the naming convention that we have.
For Instance , if a computer is to be imaged and used in 10th Floor then the name of the Computer will be Comp10 + the last 6 of the MAC address without the dashes.
 if a computer is to be imaged and used in 20th Floor then the name of the Computer will be Comp20 + the last 6 of the MAC address without the dashes.
So probably we need a script for each task sequence for each Floor.

Any better Strategy and the right script will be very much appreciated.

Thanks
0
I would like to create a form, which will pull from a .csv file, and from specific columns from a .csv file.
Which software/scripting will allow me to do this?

The form template can be in word, excel or another format as long as it pulls data from specific columns in the CSV file.
0
I am looking for the best way to log off particular users (Not all users) our 2016 terminal server (Work-group Environment). I know there is a local policy User Configuration > Policies > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits but this policy app to all users.
I need a policy or script which logoff two users (for example john and Ben) after 1 hours inactivity/idle.
Please note its not domain joined server.
0
Hello experts,
I would like to automate go to previous position action.
This feature is extremely useful and I use on a regular basis on VBA editor through Shift + Ctrl + F2 and on Word editor through Ctrl + Alt + Z . However this feature is not available at:
Notepad ++, SciTE4AutoHotkey, Powershell or SSMS.
Those applications have lines management so I think that the go to previous position can be set up.
If it is not possible to have an AutoHotkey for all the applications, I would like to have at least for Notepad++.
If you have questions, please contact me.
Thank you for your help.
0
OWASP: Avoiding Hacker Tricks
LVL 13
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Hello experts,
I have the following scripts which allows me to remove two or more consecutive extra lines & spaces
;====================================
;Remove two or more consecutive extra lines
;====================================

^!Space::
  ; clipboard:="" ; Joe commented out - not needed because Ctrl+c replaces Clipboard
  Send, ^a 
  Send, ^c
  ClipWait,1 ; Joe added - good practice to do a ClipWait after Ctrl+c
  If (ErrorLevel=1)
  {
    MsgBox,4144,Error,No text appeared on clipboard after waiting for one second
    Return
  }
  Clipboard:=RegExReplace(Clipboard,"\R\R\K\R+") ; replace two or more consecutive blank lines with a single blank line
  sleep 100
  ; Joe: see if last two chars are CR and/or LF
  LastChar:=SubStr(Clipboard,0,1)
  If ((LastChar="`r") or (LastChar="`n"))
    StringTrimRight,Clipboard,Clipboard,1
  If ((LastChar="`r") or (LastChar="`n"))
    StringTrimRight,Clipboard,Clipboard,1
  Send, ^v
  Return

;====================================
;Remove extra spaces
;====================================

+^Space::
  ; clipboard:="" ; Joe commented out - not needed because Ctrl+c replaces Clipboard
  Send, ^a 
  Send, ^c
  ClipWait,1 ; Joe added - good practice to do a ClipWait after Ctrl+c
  If (ErrorLevel=1)
  {
    MsgBox,4144,Error,No text appeared on clipboard after waiting for one second
    Return
  }
  Clipboard:=RegExReplace(Clipboard,"` +","` ") ; replace multiple spaces with one space
  sleep 100
  Send, ^v
  Return

Open in new window

They work perfectly here.
The only think that I would like to improve (if possible) is to go to previous cursor position after executing the script instead of going to the end of the file.
Example:
Example:
I have the cursor in line 3.
I launch the AutoHotkeys then the cursor goes to the end of the file instead of returning to line 3.
In my example I mention "line" however it should also goes to previous position for apps that don't manage lines such as word or VBA Excel editor.
If you have questions, please contact me.
Thank you for your help.
0
I need a custom script or batch written to check for the existence of two daily files that should exist for the next day. More specifically, we have a scheduler system that should be exporting a proprietary file for the next day. If this file does not get created then someone needs to be alerted prior to midnight when that file would need to be used. The scheduler is creating two files for each day so we would need to check for both. The format of the files is MEGA%MM%%DD% and BLAZE%MM%%DD%, where %MM% is the 2-digit month and %DD% is the 2-digit day of the month. Example of files: MEGA0913 and BLAZE0913. Neither file has a file extension so Windows just sees them as a type 'file'. I plan on using task scheduler to check for both files at 9pm of the day before. So on the 13th, the script would run at 9pm and be looking for MEGA0914 and BLAZE0914. Both files reside in the same folder. If either of the files is missing then the script needs to send an email, using BLAT or similar to alert an email address as to which file(s) are missing.
0
Fill Google Spreadsheet with data from Google Contacts

My Google Contacts database is potentially one of the most valuable information resources that I have and I would like to be able to sort and filter it more efficiently.  The built-in options at contacts.google.com just don't do enough and exporting and importing is very old-school.

I need to be able to sort and filter them using a Google Spreadsheet instead of being relegated to the minimal options provided within the context of the Google Contacts page itself.  

One option might be to use the Google scripting area under the Tools menu item within the spreadsheet. Assistance is greatly appreciated.

I would greatly appreciate any assistance in resolving this challenge and I have begun a sheet below to give us a point of reference as I try to find a solution to implement here.

https://docs.google.com/spreadsheets/d/14OH97o7dSVa5eC4WXjwHKdzmsJEinQLrVldaqOF-MwE/edit#gid=1636004216
0
I would like the abiilty for a computer running Windows 10 to take a snapshot of what is on the desktop every morning at 10 am and save it somewhere on teh server in a specific path.
Or to email that snapshot to a specific email.
Is there a script or program that would allow this function?
0
Hi

We have Windows 2012 Domain controllers and Windows 10 and windows 7 workstations in our network.

I have a Microsoft word file and i want to copy this file to Public Desktop ( All users desktop)
C:\Users\Public\Desktop

Secondly if the file is already copied to the public desktop , i would like the GPO to ignore the copy .

Please post me the best way to do this.
We use login.vbs  Script for the staff when they login.
Will it be best to copy this word file using the VBS script or through GPO.

Any tutorials much appreciated thanks in advance.
1
I would like to write a simple script which is always running.
It checks a specific folder to see if a pdf file is there and if it is it should open Outlook and attach the file so that the user can send the attachment to specific recipients.
0

Scripting Languages

28K

Solutions

21K

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.