Scripting Languages

26K

Solutions

72

Articles & Videos

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

Need help with combining these script together if it can be done, any help is appreciated.

Also want to mention, this will be for use in a large environment, 20k or so, and I plan on having as a scheduled task.  Not sure if this is an efficient script or will be too intrusive.  Input is welcome.

The first script goes through all mailboxes in ExO, and if it's a member of a group "MobileUsers", it enables activesync and owafordevices, for everything else it disables these features.

Import-Module MSOnline
$mailboxes = Get-CASMailbox -resultSize unlimited
$asusers = Get-DistributionGroupMember -Identity 'MobileUsers'

$asguids = @()
foreach ($user in $asusers) {
    $asguids += $user.GUID
}

foreach ($mailbox in $mailboxes) {
    if ($asguids -contains $mailbox.GUID ) {           
        if ($mailbox.ActiveSyncEnabled -ne $true) {     
            $mailbox | Set-CASMailbox -ActiveSyncEnabled $true –OWAforDevicesEnabled $True
        }
    }
    else {
        if ($mailbox.ActiveSyncEnabled -ne $false) {   
            $mailbox | Set-CASMailbox -ActiveSyncEnabled $false –OWAforDevicesEnabled $false
        }
    }
}

Open in new window


The second script (which can be based off of the same "MobileUsers" group, I have to set an license SKU in ExO for intune.  The header from the input file is:   "UPN","usagelocation","SKU"#

$users = import-csv .\intune.csv -delimiter “,”
foreach ($user in $users)
{
$upn=$user.UPN
$usagelocation=$user.usagelocation
$SKU=$user.SKU
Set-MsolUser -UserPrincipalName $upn -UsageLocation $usagelocation
Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses $SKU
}

Open in new window

0
What Is Transaction Monitoring and who needs it?
LVL 1
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Hi Experts,

Im new to powershell. I want to filter only to show Microsoft products installed in a machine and save it to a file. Below is the script Im writing. Is there anywhere i can fit where-object in it or any other suggestions.

Get-WmiObject -Class win32_Product -ComputerName $pc -Property name,vendor,version,installdate | ForEach-Object {
    '{0},{1},{2},{3},{4}' -f $env:COMPUTERNAME,$_.Name,$_.Vendor,$_.Version,$_.InstallDate
} | out-file C:\"$env:COMPUTERNAME"_SW01.txt

Open in new window

0
Hi

We use Windows 7 workstations and  antivirus product has been installed on 300 PCs on our network.

Now we have procured a new antivirus software and i would like to uninstall the old antivirus and install the new antivirus.When i try to install the new antivirus on the PCs, it fails and the error says , that the new AV cannot be installed until the old antivirus is uninstalled.
Please suggest if there is a way uninstalling the old antivirus.
Thanks and any help would be great.
0
Hey guys,

Am new to this community , I have a trouble over here while i am trying to delete the registry value.

Command:

reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders" /v "C:\Program Files (x86)\McAfee\VirusScan Enterprise\RepairCache\" /f

am getting the below Error when i execute the above command,

Error: The System was unable to find the specified registry key or value

But when i manually navigate to the registry value location and then when i try to delete it, i am able to delete it. Why its not working with the command?

Kindly help me with your answerserror message
0
I am working with a number of large .csv files in Windows 7,  where I need to count the number of records and if possible iterate through the files and output the filename and record count of all the .csv files (in VBSCript or Windows Batch).    Any help is greatly appreciated. Thanks.
0
I'm looking how to run the commands to delete msol users and empty the recylce bin from a csv or txt list, the commands I have are:

Remove-MsolUser -UserPrincipalName users@domain.com -Force
Remove-MsolUser -UserPrincipalName users@domain.com -RemoveFromRecycleBin -F

Thank you
0
Hello Folks,
I'm trying to do an inventory for few PCs, I would need to run this command so I can output a CSV report
 Get-HotFix -id KB4012212

Open in new window


In case is not installed I would need to get this in the report as well..

I think for "for each will be in play"?
thanks for your awesome support

or if there another type of conversion to a differnt language such batch or vbs that be awesome too
0
I have a python script that will construct a list of futures contracts for a specified symbol, exchange, and year window.  The script will download pricing information from Quandl for each contract in the strip.  This script works properly.

import pandas as pd
from pandas import ExcelWriter
import quandl

symbol = 'ES'
exchange = 'CME/'

start_year = 2015
end_year = 2016


#Constructs a list of futures contract codes for a particular symbol
#and timeframe.
futures = []
months = 'HMUZ'
for y in range(start_year, end_year+1):
    for m in months:
        futures.append("%s%s%s%s" % (exchange, symbol, m, y))

#Download the data from Quandl.
for f in futures:
    quandl.ApiConfig.api_key = "xxxx"  
    data = quandl.get(str(f))
    data = data.drop(data.columns[[3, 4, 7]], axis=1)

I have another python script that will create a continuous futures contract from 2 consecutive contracts in the futures strip.  It uses the perpetual method; identifying the roll date as the first day where volume of the far contract exceeds volume of near contract, and then adjusts the prices of the previous 4 sessions to roll date by weighting the near and far contracts in increments/decrements of 20%.  This script works properly.

import pandas as pd
from pandas import ExcelWriter
import quandl

#Get quandl futures data
quandl.ApiConfig.api_key = "xxxx"    
contract_near = quandl.get("CME/ESH2015")
contract_far = quandl.get("CME/ESM2015")

#Drop the columns …
0
Hello experts,

I am trying to call the ajax function only if there are values in 'stepname' and 'altmethod' else show and alert. When I include the following code, the else part gets executed all the time though there are no values. Could anyone kindly help me with this.

$(document).on("click", '#nextstep', function(e) {

    e.preventDefault();
 var stepname = $('#stepname').val(); 
 var chosen_altmethod = $('#chosen_altmethod').val();
 var altmethod = $('#altmethodname').val();

 
var formData = new FormData();
formData.append('stepname',stepname);
formData.append('altmethod',altmethod);
formData.append('chosen_altmethod',chosen_altmethod);
 formData.append('action','nextstep');

 console.log(stepname,"stepname");
console.log(altmethod, "altmethod");
console.log(chosen_altmethod,"chosen_altmethod");

if((stepname=="undefined") && (altmethodname=="undefined")){
  alert('please choose a step');
}else{
        $.ajax({
             type: 'POST',
            url: "<?= base_url() ?>index.php/variants/fetchstep1/",
             data: formData,
             processData: false,
      contentType: false,
             success: function (data) {

   $("#steplist").remove();
 $("#replacelist").html(data);
   $('html, body').animate({ scrollTop: 0 }, 0);
             }
         });
}
     });

Open in new window


Thank you in advance
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
The Ultimate Checklist to Optimize Your Website
LVL 1
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

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
Free Tool: Subnet Calculator
LVL 9
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 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

Scripting Languages

26K

Solutions

72

Articles & Videos

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.