Scripting Languages

27K

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

Dear expert

I need help with the code below, now that I got $server.name and $server.path using the import-csv, I also need the CreationTime of the file.
I tried sevral code but it didnt work as i wanted, please help.

Thanks

$servers = Import-Csv -Path C:\Scripts\serverlist.csv

$result= ForEach ($server in $servers) {
$count = (Get-ChildItem -Path $server.Path -ErrorAction SilentlyContinue | (get-item $server).LastWriteTime |Measure-Object).Count
If ($count -gt 0) {
		"$($count) Files in '$($server.Path)'; This is for $($server.DisplayName); The last write time is: $($lastWriteTime = (Get-Item $server).LastWriteTime)"
	}
} 
$result

Open in new window

1
Expert Spotlight: Joe Anderson (DatabaseMX)
LVL 13
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Dear Experts,

I have been asked to automate a video stream starting after a PC crashes.  I can put the VLC media player and OBS Studio with pre-configured parameters in Startup Menu, but the only sticking point is, there is a button that says "Start Streaming" that needs to be pushed.  After researching a bit, I found an AutoMouseClicker, which can run a script to replay the mouse movement and clicking.  But I cannot start that automatically.  It requires someone to initiate a script.  How can I a accomplish this?  I feel like I am one step away from accomplishing this.
Please advise.
0
Hi ..
I need to run some commands on a remote machine using ssh . What is the best way to automate this in Python?
I need to log in with a (known) password to the remote machine, so I can't just use ssh user@remotehost.
I'm wondering if there's a built-in module in python I could use or I need to install one.
If you have a sample script is highly appreciated.

Thank you for your help.
0
Hi,


In PowerShell if in my csv file I have the date of lastlogondate in this format: 2019-01-29  10:34:10 AM

I need to get users with lastlogondate older than 90 days. My question is:

Should I compare like this:

1- Where-Object {([datetime]::($_.lastlogondate) -le (Get-Date).adddays(-90))

or Like this:

2 -Where-Object {([datetime]::FromFileTime($_.lastlogondate) -le (Get-Date).adddays(-90))
0
Hi,


How can I import this csv file path. Is it like this?:

$UserslogonFile = "users.csv"

$Users = Import-csv -Path ""C:\temp\$($UserslogonFile)"
1
Hi,


How to read with PowerShell a csv file with header name containing space?

Like:
Display Name, Last Logon Date

I don't want to reformat the header name all the time.
1
Where to place the <script> tag on the HTML page?

I know there are different places you can put this, depending on the behavior you want and also depending on the type of scripts you need to load.

So, what are the different places on theHTML page and what factors govern your decision? And are these script always Javascript?

Thanks
0
Does Angular 7 NEED jQuery?

I will be starting a new project which includes:

KendoUI
Angular 7
jQuery

but my experiences with Angular 4 showed me that when you think you need jQuery, you have not looked hard enough at solving the problem using the features of Angular.

But I see this association between Angular, Kendo UI and jQuery.

https://www.progress.com/kendo-ui

How do these all fit together?

Curious.

Thanks,
0
Need a quick refresher in jQuery. Video might be a great way, but also tutorials can be great.

Thanks
0
Upgrading Angular 4 to Angular 7

I will be coding with Angular 7 in the near future and need to upgrade a project I created with Angular 4. This will be part of my preparation.

What steps need to be taken?

Thanks.
0
Microsoft Azure 2017
LVL 13
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

I would like to change this script so that when at position 100 if it sees the specific digits 078965 -
that it replaces 078965 without the leading 0 - so that the number is replaced without the 0...
It should just contain 78965



Param(
	$filename = 'c:\Temporary\Import1.csv',
	$newFile  = 'c:\Temporary\Import2.csv'
)
$content = Get-Content $filename

$outRecords = @()

foreach( $record in $content )
{
	$array = $record.Split( ',' )
	## entries in $array are zero-based
	if ($array.Length -lt 101) {
		$outRecords += $record
	} else {
	     if ($array[3] -eq '65-ABCDEF' ) {
		if ($array[99] -eq "") {
		      if ($array[98].Length -gt 5) {
			$array[99] = $array[98].substring($array[98].length-6,5)
		      }
		}
	     }
	     $outRecords += $array -join ","
	}
}
$outRecords | Out-File $newFile -Encoding ASCII

Open in new window

1
I would like to change this script so that when lookin at position position 99,  it looks only at the last 5 digits and then writes those 5 digits in position 100...



Param(
	$filename = 'c:\Temporary\Import1.csv',
	$newFile  = 'c:\Temporary\Import2.csv'
)
$content = Get-Content $filename

$outRecords = @()

foreach( $record in $content )
{
	$array = $record.Split( ',' )
	## entries in $array are zero-based
	if ($array.Length -lt 101) {
		$outRecords += $record
	} else {
	     if ($array[3] -eq '65-ABCDEF' ) {
		if ($array[99] -eq "") {
		      if ($array[98].Length -gt 5) {
			$array[99] = $array[98].substring($array[98].length-6,5)
		      }
		}
	     }
	     $outRecords += $array -join ","
	}
}
$outRecords | Out-File $newFile -Encoding ASCII

Open in new window

0
Can someone help to produce a simple script/batch?  Need to script rename file in the certain path.
So the c:\folder\filename.pdf, will be c:\folder\folder_filename.pdf

Appreciate anyone's help!
1
hello

i need a script to export ntfs right on user redirection folder, its a folder in windos 2012 server where every user have his redirected folder like this:

redirected_folder
john.smith
antonio.banderas
....

i need a script to export ntfs right for all this folder

thanks for help
2
Dear expert I need help to develop the code below:
$servers = Get-Content -Path C:\temp\test\serverlist.txt 
ForEach ($server in $Servers) {
	$count = (Get-ChildItem -File -Path $server -ErrorAction SilentlyContinue | Measure-Object).Count
	If ($count -gt 0) {
		"$($count) Files in $($server)"
	}
}

Open in new window

Now inside the serverlist there are lines with a folder path in it and its around 20 lines so 20 server path inside the txt file. Now above code check if there is 1 or more file(s) inside the server path it will show 1(or more) Files in \\serverpath, now i want to name all the path with a name for exemple result: 1(or more) Files in \\Filepath This is for SQL, 1(or more) Files in \\Filepath2 This is for Mail.

Please help. Thnx
1
Looking to install Bit-locker via simple start up script. I am running windows 10 enterprise with at least build 17134 with some running newer version. I need to have it run TMP Only and encrypt the drive. I plan to have GPO attached do most of the configuration. Please advise the simplest and best way to go forward with deploying bitlocker. AND do not make it use SCCM we have to use WDS. Bitlocker-GPO.docx
0
I am working with a .csv file and I need to change some of the contents.  - let's name it Input2.csv
Below is an example of the content.  These are only 2 lines, however there could be multiple lines in one .csv file.
In this sample, each line starts with 9,J.. and in this case ends with 002.. however each line can be different..

I would like a Powershell (.ps1) script which will look at position 4 first - if it sees 65-ABCDEF then it looks at position 101.

I have provide an incomplete script which I would like to modify to work with this type of data.
 
If position 101 is blank, then it looks in position 100, and looks at tast 6 digits of position 100,  takes those six numbers - removes the last digit, and
write the 5 digits in position 101 - without touching the rest of the data and saving it to a new file called newfile1.csv

So in the examples below, since in position 3 it sees 65-ABCDEF, it then looks in position 100 and sees that it's blank.. therefore it looks at position 99.
There in the first line it sees the number 12345678123452 - therefore it will look at the last 6 digits.. being 123452, remove the last digit, and then it will write those digits
in position 100.. so side by side positions 99 and 100 would look like this before it moves on to the next line..   12345678123452,12345,

Thanks in advance for any assistance you can provide.


9,J,01234,65-ABCDEF,N,1234/2,12345612314,,20190220,20190319,20190319,,1234567890000,Company 

Open in new window

0
Dear expert

Please help with the code below.
Get-Content -Path C:\Scripts\serverlist.txt | Where-Object {Get-ChildItem -File -Path $_} | ForEach-Object {"File in $_"}

Open in new window

This one liner shows: in serverlist.txt if there is file in it or not, now I would like add a count in each server list how many files in there. i tried with |measure| but I don't know how to use it, anyone can assist? I would see the output: File in \\servernamn\ and number after. Thanks
0
Experts,

I have a need to insert a visio document into a word document programmatically what is the easiest way to do this?

A snippet of my code is as follows:

#Create word Instance
$merged_Object = ""|TitleHeadingBar
$Merged_Object.TitleheadingBar = "Test"
$Word = New-Object -ComObject Word.Application
#Make Word Visible
$Word.Visible = $True
#Create Blank Document
$Document = $Word.Documents.Add()
#Create Selection object
$Selection = $Word.Selection

#Alignment Options:
$Alignment = ""|Select Center,Left,Right
$Alignment.Center = "1"
$Alignment.Left = "0"
$Alignment.Right = "2"

#Create Content
$Selection.ParagraphFormat.Alignment = "$($Alignment.Center)"
$Selection.Font.Bold = 1
$Selection.Font.Italic = 1
$Selection.Font.Underline = 1
$selection.TypeText("$($Merged_Object.TitleHeadingBar))")

Open in new window


I Thought I might be able to do the following, but it fails with


$selection.InsertFile("C:\worddoc\wordmerge\Drawingvsdx.vsdx")

Open in new window


Word has encountered a problem.
At line:1 char:1
+ $selection.InsertFile("C:\worddoc\wordmerge\Drawingvsdx.vsdx")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
1
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.

Hi,

I am wrting a powershell script to export the diagnostic logs of existing powershell resources to a CSV. After Exporting the CSV will be edited and a powershell script will make the required changes.

Problem is within the pscustom object there is are properties of an object, how do i also export this to CSV:

     
 Get-AzureRmResource  | foreach {

  
  $Object = New-Object PSObject -Property @{
  
  ResourceName= $_.Name
  ResourceGroupName = $_.ResourceGroupName
  ResourceLocation = $_.Location
  ResourceID = $_.ResourceId

 
  logs = (Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).logs 
  metrics = (Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).metrics 
  workspaceid =(Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).worspaceid 
  eventhubname = (Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).EventHubName 
  id = (Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).id

     }

     $allobjects += $Object

     }
     $allobjects | Export-Csv test_1.csv

Open in new window


below are the results in CSV;

	
logs
System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]


metrics
System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]

Open in new window



Below is the output for metrics and logs, when i run the command for a resource in powershell:  


 (Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).logs 

RetentionPolicy                Category               Enabled
---------------                --------               -------
...                            DataPlaneRequests        False
...                            MongoRequests             True
...                            QueryRuntimeStatistics   False

 (Get-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -ErrorAction SilentlyContinue).metrics 

RetentionPolicy                TimeGrain Category Enabled
---------------                --------- -------- -------
...                            00:00:00  Requests   False

Open in new window


Thank you for your help in advance.

Regards,
Kay
0
I've tried 3 various commands but still getting the 2 lines of "... â./proc/22063"  messages below:
# find . -type  f  -mtime -1  -size +1 -size -25M -print |grep -v "/proc" |grep -v "^/dev" |grep -v "^/sys" 2> /dev/null |grep -v "find:"
# find . -type  f  -mtime -1  -size +1 -size -25M -print |grep -v "^/proc" |grep -v "^/dev" |grep -v "^/sys" 2> /dev/null
# find . -type  f  -mtime -1  -size +1 -size -25M -print |grep -v "proc" |grep -v "^/dev" |grep -v "^/sys" 2> /dev/null

will persistently give the following:
===========================
find: â./proc/22063/task/22063/fdinfo/6â: No such file or directory  <==
find: â./proc/22063/fdinfo/6â: No such file or directory <==
./run/utmp
./run/log/journal/ad6b737370874b7282a5c951c384d844/system.journal
./run/systemd/generator.late/vmware-tools.service

Basically I'm trying to do a Clam AV scan & that 2 lines interferes:
DIR2SCAN=$(find / -type  f  -mtime -1  -size +1 -size -25M -print |grep -v /proc |grep -v /dev |grep -v /sys 2> /dev/null)
clamscan -ri $DIR2SCAN >> /tmp/log
0
How to set log file path for robocopy. so i can what being copy, writing and completed with percentage info in simple notepad
0
I am working with a .csv file and I need to change some of the contents.  - let's name it newfile.csv
Below is an example of the content.  These are only 2 lines, however there could be multiple lines in one .csv file.
In this sample, each line starts with 9,J.. and in this case ends with 002.. however each line can be different..

I would like a simple .bat script which will look at position 4 first - if it sees 65-ABCDEF then it looks at position 101.
If position 101 is blank, then it looks in position 100, and looks at tast 6 digits of position 100,  takes those six numbers - removes the last didit, and
write the 5 digits in position 101 - without touching the rest of the data and saving it to a new file called newfile1.csv

So in the examples below, since in position 4 it sees 65-ABCDEF, it then looks in position 101 and sees that it's blank.. therefore it looks at position 100.
There in the first line it sees the number 12345678123452 - therefore it will look at the last 6 digits.. being 123452, remove the last digit, and then it will write those digits
in position 101.. so side by side positions 100 and 101 would look like this before it moves on to the next line..   12345678123452,12345,

Thanks in advance for any assistance you can provide.


9,J,01234,65-ABCDEF,N,1234/2,12345612314,,20190220,20190319,20190319,,1234567890000,Company Inc.,987 Street,,Somewhere,AB,ABC DEF,AM,,,1234567891234,ABC 1234,1 Boulevard,,Here,AB,ABC …
0
Need a practice SQL web test tool

I need to play with various queries but not waste the time configuring tables and data.

Is there one online I can use immediately?

It would also be cool if there were  PL/SQL switch ;)
Thanks
0
What are the Big Differences between Angular 4 and Angular 7?

Thanks
0

Scripting Languages

27K

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.