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

We are migrating 100 users from Exchange 2010 to O365. I need to run a script that will export to CSV individual permissions there mau be assigned to user calendars, contacts, tasks or mailboxes. I do have a script that runs a high level permission report but not on the granular level to know that user X has read only access to user Y calendar or user A has full access to user B inbox

Thanks
1
Hello,
I have in a shell script, a variable that uses xmllint like this:

Xpath_querry = $ (xmllint --shell $ {xmlfile} << EOF
    Setrootns << EOF
    Xpath count (// defaultns: $ {parse_tag /} / defaultns: $ {tag}))

This worked but now, I have an EOF error in the console at run time.
Would anyone know another way to rewrite this variable (that the variable is used later in the script)?
0
Hi All,

When I tried to copy from one Removable USB HDD to another, it failed with the logs:

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Monday, 12 June 2017 4:35:38 PM
   Source : F:\
     Dest : X:\

    Files : *.*
	    
  Options : *.* /DCOPY:DA /COPY:DAT /Z /J /MT:16 /R:1000000 /W:30 

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


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

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         1         1         0         0         0
   Files :         0         0         0         0         0         0
   Bytes :         0         0         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00
   Ended : Monday, 12 June 2017 4:35:38 PM

Open in new window




This is my Robocopy command:
C:\>Robocopy F:\ X:\ /Z /J /mt:16 /LOG:"C:\Logs\F-X-COPY-log.txt"

 Log File : C:\Logs\F-X-COPY-log.txt

C:\>

Open in new window


Any help would be greatly appreciated.

Thanks,
0
Hi Experts,

I found this code to create a DSN and except of the login and password, everything else seems to work.
Wondering if someone can help me figure out how to do the SQL Authentication mode login/pwd?
     Dim vAttributes As String
        vAttributes = "DSN=MyDSNName" & Chr(0)
        vAttributes = vAttributes & "Description=Self Explnatory" & Chr(0)
        vAttributes = vAttributes & "Trusted_Connection=Yes" & Chr(0)
        vAttributes = vAttributes & "Server=MyServerName\Instance" & Chr(0)
        vAttributes = vAttributes & "Database=DBName" & Chr(0)
        Attributes = Attributes & "LoginID=UserName" & Chr(0) & "pwd=MyPWD" & Chr(0)

        SQLConfigDataSource 0&, 1, "SQL Server", vAttributes

Open in new window

0
Hello,

I was wondering if someone could help me with a macro or some script that would search through an excel File called 'Content' and there is another Excel file called URL, with two columns, A has old URL, and column B are what the old URLs should be replaced with.

The problem is that 'Content' has many worksheets with many data, and Excel B contains thousands of links that need to be replaced.

I've attached the excel files.

EDIT:
For example, if "http://www.hc-sc.gc.ca/dhp-mps/acces/drugs-drogues/index-eng.php" occurs anywhere in the Content workbook, it should be replaced with "https://www.canada.ca/en/health-canada/services/drugs-health-products/special-access/drugs.html"

If it could be done in VBA, great, if not, then any scripting language really.
URL.xlsx
Content.xlsx
0
Hi,
I need to find a way to generate a report via either tool or PS script for AD users with last logon date of greater than 30 days.

Any help is appreciated
0
I am able to launch a script from VBA and pass parameters to that script but I would like to be able to just active a particular function on an already running script from VBA as well as pass parameters to it.

Is this possible or am I limited to launching a script from VBA?

Thanks for the help!
0
Hi

 I have a shared drive on a windows 2012 server called " Shared"
 Within this drive , there is a folder called SCIENCE and within this folder there are sub folders.
 Initially I copied this folder from another server through Robocopy. Now I would like to delete this SCIENCE folder.

 When I delete I get and error that says Item Not found
 Could not find this item
 This is no longer located in E:\Shared. Verify the items location and try again.

 Please let me know how to delete this SCIENCE Folder. Is there a way of deleting this through Robocopy
 If so please post me the exact syntax and tutorials or if there is any other way.
 Thanks
0
I would like to get the output from this wmic query put into a variable

wmic printer where default=TRUE get name

Open in new window


Further, when this is run in a command prompt, the output is:

Name
\\PRINTSERVER\MyPrinter

I would like the variable to contain only the portion after \\PRINTSERVER\ which in this case will be simply MyPrinter.
0
Why does this not work?

SET X=1
IF %X% == 1 (
    SET Y=2
    IF %Y% == 2 (
        SET Z=3
    )
)
PAUSE

Kevin
0
How to save the output of show run (Router) in text file on desktop using python.
I have a router i have to save its config file in desktop in text format using python
0
The command:

DIR %1% /S > "C:\Users\Name\Documents\Output 1.txt"

The result:

C:\Users\Name\Documents>DIR "C:\Users\Name\Documents\Folder"\Users\Name\Documents\Output 1.txt"
The system cannot find the file specified.

Where I want to end up:

DIR %1% /S > "%~dp0\Output 1.txt"

But the result with this is even worse.

Kevin
0
Our server and network team are furiously patching everything and loading the most update Symantec antivirus updates in an effort to stop the Wanna-Cry virus from infecting our systems.

But after they patched and cycled one of our scripting machines, I now get the error: Can't find script engine "VBScript".

I have tried re-registering the "cscript.exe", and it registers successfully, but I set get the error.

I know from years past the some antivirus services would disable or intercept script engine calls, but I don't know if that is what is happing here ?!

Any help is appreciated.
0
I want to use a MacOS script on OS Scierra, so that when I double click on an icon, it automatically sends an email to specific recipients every time, and it also includes an attachment named, for example 1.pdf.
This is using a network using Exchange 2010 on site.
Thanks to anyone that may help with this script, or program.
0
Thank you for looking at my question,

I want to check that a value has been entered to an html form and am trying the code below. I have tried not entering any value in the input box and clicking the submit button but I don't get the warning message I was expecting, can anybody tell me why that might be because I can't see what's wrong?
<html>
	<head>
		<title>Production Data Sheet</title>
		<script type="text/javascript" language="JavaScript">
			function jsValidate(){
				var w = document.forms["Form1"]["SerialNo"].value;
				if (w == ""){
					alert("Serial No Value Missing");
					return false;
				}
			}
		</script>	
	</head>
	<body>
		<form name="Form1" action="Forms/Section1.php" method="Post">
			<div>
				<table style="width:15%; border: 1px solid black;">
					<tr>
						<td>Serial No</td>        
						<td><input type="text" name="SerialNo"><br /></td>
					</tr>			
					<tr>
						<td colspan="2"><input type="submit" value="Submit" style="float: right;" onSubmit="return jsValidate()"></td>
					</tr>
				</table>
			</div>
		</form>
</body>
</html>

Open in new window

0
Hi

Currently the student’s home directories are located on our Windows 2003 server E drive On the Win2003 Server the Local Path to the share is: E:\StuDocu
Remote path from my workstation to the Win2003 share is: \\Win2003\StuDocu
Within the shared folder “StuDocu” there are separate folders for Yr7, Yr8... and within each of these folders there are 100 of student’s home directories.

\\Win2003\StuDocu\Yr7\User1,User2,User3........., User200
\\Win2003\StuDocu\Yr8\User201,User203,User204.........,User400..


I have built Windows 2012 server and would like to migrate all the students’ folders from our old Windows 2003 server to our new Windows 2012 server.

On the Windows 2012 server I have created a separate Drive “E” and have created a shared folder called StuDoc on this drive.

Now I would like to Copy the files from Win2003 to Win2012 server and also would like to copy the permissions and the directory time stamps

\\Win2003\StuDocu\Yr7  to \\Win2012\StuDocu\

I want to copy the complete Yr7 folder first and Yr8 and so on ...

Please let me know as how to achieve this and post me the syntax to do this task from Robocopy.

Thanks in advance.
0
Hi All,

I've stumbled upon this script in this great forum, but somehow I cannot get it to work:

Basically thi script is to check through each of the specific AD computer object in the specific OU for specific type of Patches installed status or not, then Export it to .CSV file.

$Computername = Get-ADComputer -Properties Name, OperatingSystem, OperatingSystemVersion, LastLogonDate -Filter { Enabled -eq $True } -SearchBase "OU=Production Servers,OU=Servers,DC=MyDomain,DC=com" |
                Where-Object { Test-Connection $_.Name -Count 1 -Quiet } |
                Select-Object -Property Name, OperatingSystem, OperatingSystemVersion, canonicalName, LastLogonDate

$patches = 'KB4012598', #Windows XP, Vista, Server 2003, 2008
            'KB4018466', #Server 2008
            'KB4012212', 'KB4012215', 'KB4015549', 'KB4019264', #Windows 7, Server 2008 R2
            'KB4012214', 'KB4012217', 'KB4015551', 'KB4019216', #Server 2012
            'KB4012213', 'KB4012216', 'KB4015550', 'KB4019215', #Windows 8.1, Server 2012 R2
            'KB4012606', 'KB4015221', 'KB4016637', 'KB4019474', #Windows 10
            'KB4013198', 'KB4015219', 'KB4016636', 'KB4019473', 'KB4016871', #Windows 10 1511
            'KB4013429', 'KB4015217', 'KB4015438', 'KB4016635', 'KB4019472' #Windows 10 1607, Server 2016

$KBList = @($patches)

Invoke-Command -ComputerName $Computername -ArgumentList (,$KBList) -ScriptBlock {
	Param($KBList)
	$Session = New-Object -ComObject 

Open in new window

0
hello can someone provide a way that I can change these scripts below to use an input TXT or CSV file, so that we do not have to run this one by one to create users and groups.  

script #1 - we need to add a variable to pull from an input CSV file for bulk creation:

$sj = New-PAMUser –SourceDomain mydomain.com –SourceAccountName jsmith
$jp = ConvertTo-SecureString "Pass@word2" –asplaintext –force
Set-ADAccountPassword –identity priv.jsmith –NewPassword $jp
Set-ADUser –identity priv.jsmith –Enabled 1

Open in new window


script #2  - same requirement for group creation:

 $ca = get-credential –UserName admin@mydomain.com –Message "CORP forest domain admin credentials"
 $pg = New-PAMGroup –SourceGroupName "group1priv2" –SourceDomain mydomain.com                 –SourceDC dc1.mydomain.com –Credentials $ca
 $pr = New-PAMRole –DisplayName "priv.group1priv2" –Privileges $pg –Candidates $sj

Open in new window

0
I am looking at permissions and the code part below works fine, I would however like to not see some results, like "builtin".
I was trying where-object, but that's not helping, and/or I can't get the syntax right. Is there a simple way to not display, or filter out findings such as builtin and administrators, etc?
get-Acl | Format-List -property AccessToString | Out-File -append "C:\somepathorother\shares.txt"

Open in new window


Thanks!!
0
I have the below script that pulls from a list and outputs to a csv the samaccountname and mail attributes.

What I'm trying to do is next to each user check if each user is a member of a certain AD Group, or two AD Groups actually, for this example, the name of the two groups would be "GroupA" and "GroupB"

So the output would be, listing the name of the two groups I want to check in columns 3 and 4:

sAMAccountName     mail                                        GroupA                   GroupB  
--------------------------      -------                                       --------------               --------------
user1                            user1@domain.com           GroupA
user2                            user2@domain.com                                             GroupB


Assuming user1 is a member of GroupA and user2 is a member of GroupB

Import-Csv -Path C:\Temp\users.csv | ForEach-Object {
	Get-ADUser -Filter "(sAMAccountName -eq '$($_.sAMAccountName)')" -Properties sAMAccountName,mail  | Select-Object sAMAccountName,mail
} | Export-CSV mailusers.csv -NoTypeInfo

Open in new window



Thanks,

Ron
0
Hello everyone,

I have configured our Nagios instance to monitor a Xerox printer with the Check_SNMP_Printer plugin (https://exchange.nagios.org/directory/Plugins/Hardware/Printers/SNMP-Printer-Check/details), and am receiving information fine. The issue is that it is the wrong information. It is returning the Transfer Belt info on all checks except the paper trays (screenshot1).

If I manually run the command, I get the same response (screenshot2). I have checked the script and the Universal SNMP OIDs are correct. for my printer. If I snmpwalk the OIDs listed, they return expected output.

I am a bit at a loss as to what the issue is. I can only assume something is wrong with the logic?

Any insight i can get on this is greatly appreciated!
Screenshot1.png
screenshot2.png
0
Hi Everyone, I have the following script:

#!/bin/bash
TMPFILE=/home/david/testwp/temp.txt
touch $TMPFILE
curl https://api.wordpress.org/secret-key/1.1/salt/ > $TMPFILE
AUTHKEY=$(grep AUTH_KEY $TMPFILE | grep -v SECURE)
sed -i "s/define\(\'AUTH_KEY\'\,         \'put your unique phrase here\'\)\;/$AUTHKEY/" /home/david/testwp/wp-config-sample.php
echo $AUTHKEY
rm $TMPFILE

Open in new window


While the curl and the grep pull out the correct output (verified by the echo, it doesn't seem to change the value in the sample file.
Ideas?
0
Hi,

I have 2 sets of same files created with different time stamps and I want to compare these files using beyond compare. However each set has multiple files so I want this comparison to run in a loop until it reaches end of files in the folder.

eg:

Set 1:
output_sql20170522-2022_1.txt
output_sql20170522-2022_2.txt
output_sql20170522-2022_3.txt

Set 2:
output_sql20170522-2135_1.txt
output_sql20170522-2135_2.txt
output_sql20170522-2135_3.txt

Both Set 1 and Set 2 files are present in same folder. So I want the comparison to happen as below,
output_sql20170522-2022_1.txt to be compared with output_sql20170522-2135_1.txt
output_sql20170522-2022_2.txt to be compared with output_sql20170522-2135_2.txt
output_sql20170522-2022_3.txt to be compared with output_sql20170522-2135_3.txt

And each of the output should be saved to a report.

Kindly help!
0
I am having a very complex string that I need to tokenize and also create name pair values when possible. Here is a sample of the strings I have

Recod Style 1
Search Result Queries;SomeHotel.com;PT\=89030726\;PA\=-1119567914\;PS\=1547518063;2017-05-13 01:43:36.719;Search Results Query BT SPLIT=checkInDate\=5-13-2017&checkOutDate\=5-14-2017&numberOfAdults\=1&propertyIds\=MS140|MS741|MS1290|MS1334|MS1349|MS4557|MS4568|MS4783|MS4854|SS6029,Web Requests - Client IP=50.251.11.233;Execution Time Informix=2404.003662109375,DB Count=2.0,DB Time=2404.0037887319922;false;;2424.760498046875;2424.760498046875;8.655830353498459;2424.7605440989137;;;;SomeHotel_PROD;dyntrc-mgmt.SomeHotel.com


Recod Style 2
Search Result Queries;Mobile App;PT\=89031695\;PA\=-1119567914\;PS\=1547518063;2017-05-13 01:44:17.772;Search Results Query BT SPLIT=checkInDate\=5-13-2017&checkOutDate\=5-14-2017&corporatePlusNumber\=&numberOfAdults\=1&propertyIds\=MS1173%7CMS4961%7CMS4376%7CMS4281,Web Requests - Client IP=66.115.209.42;Execution Time Informix=1762.662109375,DB Count=5.0,DB Time=1759.847623437643;false;;1781.0732421875;1781.0732421875;10.074070394039154;1781.0732627734542;;;;SomeHotel_PROD;dyntrc-mgmt.SomeHotel.com

Both record styles happen in the same file.

Main delimiter above is;
some values are name-value pairs delimited on \= or =
Some fields contain other fields and delimited by &

Any ideas on how to parse this so I can convert it to some CSV or json
0
Hello Folks,
I'm tying to write a Poweshell Script to delete objects from AD as well as SCCM
so far i have to deletion part working but i'm trying to add the reports and this is where I need help

For AD I have the following
foreach ($ComputerNameAD in $CLIENT) { 

    # Echo remove from AD
    dsquery computer -name $ComputerNameAD|dsrm -noprompt >>C:\Temp\REPORTAD.csv

    # Echo Results
    Write-Host "Removed $ComputerNameAD from AD server." -ForegroundColor White -BackgroundColor Black
}

Open in new window

Howerver the CSV log file only writes the computers that were actually deleted but not the ones that failed

and for SCCM console i have this
foreach ($ComputerNameSC in $CLIENT) { 

    # echo remove from SCCM
    Remove-CMDevice -DeviceName $ComputerNameSC -Force
	if($?) {            
		Write-Host "Object named $ComputerNameSC was deleted successfully from SCCM">>c:\temp\ReportSCCM.txt
}   else {            
	write-host "There was an Error trying to delete object named $ComputerNameSC ">>c:\temp\ReportSCCM.txt
}
    # Echo Results
    Write-Host "Removed $ComputerNameSC from SCCM server." -ForegroundColor White -BackgroundColor Black
}

Open in new window


but it doesn't write anything to the report.
Now, with that said the command to delete doesn't give anything message, it only ask if you are sure to delete then it just jumps to the next line or proceeds with the next object if there's any...

Any ideas would be welcome or any other method that will perform the same task. thanks for looking
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.