Scripting Languages

27K

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

Hi Experts,

We have windows server 2008 along with multipal users they have only remote desktop rights & i dont want assign administrator rights,

but a there is a software which need administrator rights (run as administrator) permission to execute from users, we had manage till startup time manually to run as a administrator with password but now there is more than 50 users that's why i can't manage manually.

I need a batch file which have store administrator password, I'll paste that batch to every user Desktop & locate the software path to in batch file run as administrator.



Path Example :-
for user1
D:/user1/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user2
D:/user2/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user3
D:/user3/NEW_4.1.1.1_12082018_PAN_A/EnhanceT.ext

for user4
D:/user3/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user5
D:/user5/Gm_4.1.1.1_05082018_PAN_5/EnhanceT.ext

for user6
D:/user5/Gm_4.1.1.1_05082018_PAN_6/EnhanceT.ext
0
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Hi All Experts,

I need some assistance in the below PowerShell script to list which mailbox in the list currently forwarding email and where it is to after that export as .CSV

The input will be:
John Gross
Michael Mordechai
Frank Cummings
...

Open in new window



$InputCSVPath = 'C:\Input.csv'
$ExportCSVPath = 'C:\Output.csv'

$Users = Get-Content -Path $InputCSVPath
&{
       foreach ($User in $Users) {
              Write-Host "Processing.... $User"
              Get-Mailbox $User.ToString() | Select WindowsEmailAddress 
       } 
}| Export-Csv -Path $ExportCSVPath -NoTypeInformation

$AllMailboxes = Import-CSV $ExportCSVPath

&{ 
    foreach ($item in $AllMailboxes) {
        $mbx = Get-Mailbox $item.WindowsEmailAddress | Select DisplayName, ForwardingAddress | where {$_.ForwardingAddress -ne $Null}
        Write-Host "Processing...$($mbx.Alias)..." -ForegroundColor Yellow
    }
} | Export-CSV -Path $ExportCSVPath -NoTypeInformation

Open in new window


Error message:

Processing......
Cannot process argument transformation on parameter 'Identity'. Cannot convert value "@{WindowsEmailAddress=John.Gross@domain.com}" to type
"Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter". Error: "Cannot convert hashtable to an object of the following type:
Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter. Hashtable-to-Object conversion is not supported in restricted language mode or a Data section."
    + CategoryInfo          : InvalidData: (:) [Get-Mailbox], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-Mailbox
    + PSComputerName        : PRDEX04-VM

The .CSV output is blank?

Thank you before for your helps.
0
I need to copy a file to a local machine via script to automate to push this change that I need to make. Could you guide me of a sample script? I will be putting the file in a shared folder and then push the file to a programdata application folder.folder.

Thanks,
Jason
0
i have 50+  plus standalone servers running windows 2008 std edition, not in a domain , uses the same userid and password across the servers

Im looking for a script for C drive, if server C drive space is less than 10gb, it will give me the hostnames.

So that I can logon and clear some space, as 10gb is expected to have server free space in each of 50 Systems
0
hi i what to put comma delimeted when i do cat of file





cat filename*.out > filename.out



the file is like this

DB: eca1

Input truncated to 37 characters





NSN     INSTANCE   Unit Code

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

18-018-6113 ECA1    10582





DB: fsa1

Input truncated to 37 characters





NSN     INSTANCE   Unit Code

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

18-018-6113 FSA1    10622



i what file to be like this so i can put in excell



NSN           INSTANCE   Unit Code

18-018-6113 FSA1           10622

18-018-6113 ECA1         10582
0
Hi Experts,
I have the following function trying to synchronize my local folder with a FTP folder.
Sub Example()
 
    Dim mySession As New Session
    
    ' Enable custom error handling
    On Error Resume Next
    
    Download mySession
    
    ' Query for errors
    If Err.Number <> 0 Then
        MsgBox "Error: " & Err.Description
 
        ' Clear the error
        
        Err.Clear
    End If
     
    ' Disconnect, clean up
    mySession.Dispose
     
    ' Restore default error handling
    On Error GoTo 0
    
End Sub
Public Sub Download(ByRef mySession As Session)
'Public Sub Download()
    ' Setup session options
    Dim mySessionOptions As New SessionOptions
    With mySessionOptions
        .Protocol = Protocol_Sftp
        .hostname = "sftp.MySite.com"
        .username = "MyUser"
        .password = "MyPWD"
        .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
        
        
    End With
    
    ' Connect
    mySession.Open mySessionOptions
    
    ' Upload files
    Dim myTransferOptions As New TransferOptions
    myTransferOptions.TransferMode = TransferMode_Binary
    'myTransferOptions.ResumeSupport = TransferResumeSupportState.TransferResumeSupportState_Off
    myTransferOptions.ResumeSupport.State = TransferResumeSupportState_Off
     
    Dim transferResult As SynchronizationResult
    'Set transferResult = _
        mySession.GetFiles("/Outbox/*PatChanges*", "H:\FTP\", False, myTransferOptions)

Open in new window

0
I want to automate the file transfer.
FTP Client : Reflection FTP Client
SFTP Server : Tectia SFTP Server.
I tried using similar to winscp scripts powershell but it didnt work.
Can someone help me providing the script which will work to transfer file to sftp server running script.
Authentication method is public key + password authentication and password must be encrypted.
0
Update Word Document with Data entered in Excel
sp
I have Excel sheet displayed on the screenshot above.
I also have word documents with the name that matches exactly the name of each Comp-Name.

BATH.docx
MONR.docx
STAR.docx
JUSGB.docx




Each word document has a table with the same column names as the Excel sheet

I would like to have the respective word document table updates automatically  its data to match the new entered data in Excel .
for instance If I have a new purchase, I can manually add it to a new Excel row, and the program should add that new row automatically to the corresponding word document.

Example:
I have new purchase for a company MONR
On Excel , I will add new entry:
MONR      TX      3/3/2018      3/8/2018

on a corresponding word document MONR.doc, I should have the new entry added automatically to the table in word.

Any help will be very much appreciated.

Thanks
0
Dear expert
Please check below code, I got question on $cred = Get-Credential  how I do this in get-WMI process, I need the script to auth the cred user info and password saved in the variable $cred and run Get-WmiObject with the credential in the variable $cred.
Anyone know how?
Thx

Function Get-SystemInfo {
[CmdletBinding()]
Param(
	[Parameter(ValueFromPipeline=$true)]
	[string[]]$ServerNames = '.',
	[switch]$UptimeAsString
)
	Process {
        $cred = Get-Credential 
		$now = Get-Date
		$ServerNames | ForEach-Object {
			Write-Verbose "Processing $($_) ..."
			$return = '' | Select-Object -Property 'Server', 'Last Boot', 'Uptime', 'Error'
			$return.Server = $_
			Try {
				$system = Get-WmiObject -Query 'select LastBootUpTime from Win32_OperatingSystem' -ComputerName $_ -Credential $Cred -ErrorAction Stop
				$return.'Last Boot' = $system.ConvertToDateTime($system.LastBootUpTime)
				$return.Uptime = $now - $return.'Last Boot'
				If ($UptimeAsString) {$return.Uptime = $return.Uptime.ToString("dd' Days 'hh' Hours 'mm' Minutes'")}
			} Catch {
				$return.Error = $_.Exception.Message
			}
			$return
		}
	}
}
Get-Content -Path c:\script\serverlistOP.txt | Get-SystemInfo -UptimeAsString -Verbose | ConvertTo-Html | Set-Content -Path C:\script\server_rapport.html

Open in new window

0
Hi All,

I need some help in performing Exchange mailbox export as Username@emaildomain.com for each member of the .CSV file as the input?

The input CSV file content from the HR department only contains one column with First Last name format:

user
John Herschel
Mark Sunderland
Cory Jones
Alex Ho
Sue Chen
Lin Fang
....

Open in new window


So any help to modify the below PowerShell script would be greatly appreciated.

Issue 1: How to make sure the input.CSV can match the Display Name of the Exchange mailbox?
Issue 2: How to export the mailbox that failed to process as .CSV file list so I can manually export the .PST?

#Import remote session with exchange on my laptop where Outlook is installed
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://PRODEX02-VM/Powershell/ -Authentication Kerberos
Import-PSSession $Session

$ServerBackupUNCPath = "\\BACKUP\OST\"
$CSVPath = "\\computername\c$\users\user\desktop\users.csv"

try{
	$AllMailboxes = Import-CSV $CSVPath
	foreach ($mbx in $AllMailboxes) { New-MailboxExportRequest -Mailbox $mbx -FilePath "$ServerBackupUNCPath$($mbx.Alias).pst" -baditemlimit 50 -acceptlargedataloss; while ((Get-MailboxExportRequest -mailbox $i | Where-Object { $_.Status -eq "Queued" -or $_.Status -eq "InProgress" })) { Start-Sleep 120 } }
	
	Write-Host "Processing...........$mbx.Alias................" -ForegroundColor Green
}
catch{
	Write-Host "Exception has occured processing....$mbx.Alias...." 

Open in new window

0
Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Hi Experts,

I have the function below that downloads files from a FTP server.

Option Explicit
 
Sub Example()
 
    Dim mySession As New Session
    
    ' Enable custom error handling
    On Error Resume Next
    
    Upload mySession
    
    ' Query for errors
    If Err.Number <> 0 Then
        MsgBox "Error: " & Err.Description
 
        ' Clear the error
        Err.Clear
    End If
     
    ' Disconnect, clean up
    mySession.Dispose
     
    ' Restore default error handling
    On Error GoTo 0
    
End Sub

Private Sub Download(ByRef mySession As Session)
 
    ' Setup session options
    Dim mySessionOptions As New SessionOptions
    With mySessionOptions
        .Protocol = Protocol_Sftp
        .HostName = "example.com"
        .UserName = "user"
        .Password = "mypassword"
        .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
    End With
    
    ' Connect
    mySession.Open mySessionOptions
    
    ' Upload files
    Dim myTransferOptions As New TransferOptions
    myTransferOptions.TransferMode = TransferMode_Binary
     
    Dim transferResult As TransferOperationResult
    Set transferResult = _
        mySession.GetFiles("/home/user/*", "H:\FTP\", False, myTransferOptions)
     
    ' Throw on any error
    transferResult.Check
     
    ' Display results
    Dim transfer As TransferEventArgs
    For Each transfer In transferResult.Transfers
        MsgBox "Download of " & transfer.Filename & " 

Open in new window

0
Looking to set up "Honey token" or Trip Wire" in Windows PCs and servers.

I have read that you can use /NetOnly to dump fake username/passwords into Lsass.

How can I do this across the domain silently?
0
When I run this below code for multiple servers, the output I am getting is combined and I want to separate them according to their IP or Names. Could you please help me below query.


$Servers = Get-Content c:\temp\servers.txt
foreach ($Server in $Servers)
{
    Invoke-Sqlcmd -ServerInstance $Server -Database master -Query 'Exec sp_databases'
}

Open in new window

0
Hello Folks,
Does anybody know how to Disable Windows 7 from copy/paste  or keeping it from doing so? or eliminating the clipboard ?
0
Hi,

Powershell coding:

I would like to first export all the users in AD that missing a displayname to a excel csv.
Then edit all the displaynames to the users that miss the displayname in that excel file.
Then use get-content to set-aduser to those displayname with the right account.

Anyway to do this?
0
Powershell scripting.

Dear expert

c:\test\01\test.txt
c:\test\02\test.txt
c:\test\03\test.txt
c:\test\04\test.txt

I need a script that take the first folder 01 file to another folder and then delete the 01 folder. Then it will stop here once removed 01 folder, next day i want the same progress with 02 folder and 03 etc.

Please help. Thanks
0
I want to delete particular row when I click on delete icon ?
Append row working fine when I click on '+' sign


JavaScript Code :
<script type="text/javascript">
  var count=2;
  function addnewrow()
  {
    
    var div = '<div class="row col-md-12" id="row'+count+'">'+
    '<div class="col-md-2">'+
        '<div class="form-group">'+
          '<label for="p_type"><font color="red">*</font>Product Type</label>'+

          '<select id="p_type" name="p_type" onChange="getCatg(this.value,'+count+');" class="form-control" tabindex="1" required>'+
            '<option>Select Product Type</option>'+
            '<option value="Goods">Goods</option>'+
            '<option value="Service">Service</option>'+
          '</select>'+
        '</div>'+
    '</div>'+

    '<div class="col-md-3">'+
      '<div class="form-group">'+
        '<label for="c_name"><font color="red">*</font>Sub-Category</label>'+
        '<select name="c_id" id="c_id_'+count+'" onChange="getProd(this.value,'+count+');" class="form-control" required>'+
          '<option>Select Sub-Category</option>'+
        '</select>'+
      '</div>'+
    '</div>'+
'</div>'+

'<div class="col-md-12">'+
  '<div class="table-responsive">'+
'<table  class="table table-bordered table-hover">'+
          '<thead>'+
            '<tr>'+
              '<th width="20%">Item Details</th>'+
              '<th width="20%">Vendor Name</th>'+
              '<th width="20%">Quantity</th>'+
 

Open in new window

0
Morning all, I'm looking for some code that will enable IE and Chrome to go fullscreen when the web page opens. We have a number of browsers, so a single bit of code would be great.

I've added the current code I have.

What would be the best method to achieve this?

Many thanks

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Edward</title>
</head>
<body bgcolor="#000000">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
:
Min
Sec
-->
<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1280" height="1024" id="Edward" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Edward.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="Edward.swf" quality="high" bgcolor="#000000" width="1280" height="1024" name="Edward" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>

Open in new window

0
Hi Experts,

I have the script below do download all new files from my FTP server into my local PC.
However after running it for a while I get the attached error.

# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"

# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = "sftp.MySite.com"
    UserName = "MyUserName"
    Password = "MyPWD"
    SshHostKeyFingerprint = "1234567890="
}

$session = New-Object WinSCP.Session

try
{
    # Connect
    $session.Open($sessionOptions)

    # Transfer files
    $sourcePath = "/Outbox/" # don't add *, will be added where necessary
    $destPath = "H:\FTP\"
    $destPathNew = "H:\FTP\Caspio\"

    $transferOptions = New-Object WinSCP.TransferOptions

    while($True)
    {
        try {
            # Get list of matching files in the directory
            $remoteFiles = $session.EnumerateRemoteFiles($sourcePath, "*.*", [WinSCP.EnumerationOptions]::None)

            # Any file matched?
            if ($remoteFiles.Count -gt 0) {
                foreach ($fileInfo in $remoteFiles) {
                    try {
                        Write-Host "Checking rules for the file " $fileInfo.Name
                        # check the filename for matching the mask
                        if ($fileInfo.Name -like "*PAT*.*" -or $fileInfo.Name -like "*Sch*.*" -or $fileInfo.Name -like "*Full*.*") {
                       

Open in new window

0
Cloud Class® Course: Ruby Fundamentals
LVL 12
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Hi ,

I found this script it is useful saving my time.
i want help from experts...
after successful transfer it moving the file to archive..but every week the activity will go and chances for overwrite.
I want to have the dateandtime stamp to put while moving the files to archive..
can help to modify the code pls..

example
Localpathfile : E:\ABC\Zip_Source\testfile.xml.zip.p7
backupPath = "E:\ABC\Backup\testfile.xml.zip.p7_DDMMYYYY_HHMMSS

Script from internet

# Upload Files to FTP and move source files to archive
param (
    $localPath = "E:\ABC\Zip_Source\*.p7",
    $remotePath = "/home/user/",
    $backupPath = "E:\ABC\Backup\"
)
 
try
{
    # Load WinSCP .NET assembly
    Add-Type -Path "WinSCPnet.dll"
 
    # Setup session options
    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
        Protocol = [WinSCP.Protocol]::Sftp
        HostName = "example.com"
        UserName = "user"
        Password = "mypassword"
        SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
    }
 
    $session = New-Object WinSCP.Session
 
    try
    {
        # Connect
        $session.Open($sessionOptions)
 
        # Upload files, collect results
        $transferResult = $session.PutFiles($localPath, $remotePath)
 
        # Iterate over every transfer
        foreach ($transfer in $transferResult.Transfers)
        {
            # Success or error?
            if ($transfer.Error …
0
Hi All,

Do we have any script for cold migration of multiple vm from one cluster to another.
0
i have multiple files to encrypt using slift software.
I have the manual steps to encrypt but need help for encrypting it.
I have restriction not to store any password in the scripts hence it required password to be encrypted.
command is
slift.exe /e "sourcedirectory" /pfx "privatekeyfile.pfx" password /cer "partnerpublickey.cer"
can help how to script in powershell.
0
I need to do a check some Registry & Files across the entire AD domain for these checks:

Output:
If the computer does not have the file or reg then output "%Computer%-NoReg"  | "%Computer%-NoFile" into a "MissingCBDefense.txt"
If the computer does have the both then output "%Computer%" into a "HasCBDefense.txt"
HKEY_LOCAL_MACHINE\SOFTWARE\CbDefense
c:\Program Files\Confer\RepUx.exe

If the computer does not have the file or reg then output "%Computer%" into a "NoSymantec.txt"
If the computer does have the file or reg then output "%Computer%-HasReg"  | "%Computer%-HasFile" into a "HasSymantec.txt"
HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Symantec Endpoint Protection\CurrentVersion
C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\Smc.exe

Note: I do have a lot of Computer Objects that no exist, therefore the script may have to skip those objects that don't really exist or reach.

Thanks in advance.
0
sourcefolder  : C:\zipto\
backupfolder : C:\Zipto\archive
i have xml files in folder..
files 1.xml, 2.xml, 3.xml
want to zip it make the file name 1.zip, 2.zip.3.zip
after sucessfull zip it should move the source file alone to backup folder with 1.xml_DDMMYYYY_HHMMSS
activities must log file logfile
can help to share script...
0
I would like to create something for an android tablet similar to a windows batch file.  I have users that will lose their connectivity to the datacenter.  It may be the internet connection or it may be the vpn.  I would like for my users to click on an icon and be able to see if they have vpn connectivity back to the datacenter.
basically it would be a batch file that would ping an internal ip address

ping 192.168.1.1 for example
is there anything like this to give my users quick intelligence if they are connected or not
0

Scripting Languages

27K

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.