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,

I have python installed on my windows 7 machine. is there any way i can go back to the previous command i typed on python, normally on powershell or cmd you press the up button.

regards,
kay
0
Introduction to Web Design
LVL 12
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Need to Use Set-WinUserLanguageList en-US to Change Language  for specific user

Can we push it remotely for specific local users on servers not in domain in silent mode

When we run it locally steps are  >Command Prompt -Type PowerShell  and hit Enter-Then Run Command -Set-WinUserLanguageList en-US -Will Ask for Y to Press

Can we get this in some script to push on remote computers in one go or if changes can be reflectedd in first login -as it is asking to log off and login again ?
0
I have a script .sh file which delete chrome data in iMAC and it works great.
How can I accomplish same for Firefox and Safari as I want all history and everything deleted and when current user opens firefox and safari it should open like a brand new one. Anyway to accomplish this via command line or script?

Thanks,
0
Hello,

We have the below script in place that's reminds staff to complete their timesheets. This is run from scheduled tasks on each machine. Does anyone know how we can do the following.

1. Stop the blue powershell console from flashing up before the message box appears.  I've tried -windowstyle hidden but that doesn't appear to work.
2. Change the options in the message box that appears. It would be good if the Yes button text could be changed to Complete (or Review) and the No button to Ignore

Code below, thanks

$currentUser = [System.Environment]::UserName
$IE = New-Object -ComObject internetexplorer.application

$strFilter = $("(&(objectCategory=user)(SAMAccountName={0}))" -f $currentUser)

$objDomain = New-Object System.DirectoryServices.DirectoryEntry

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.PageSize = 1
    $objSearcher.SearchScope = "SubTree"
    $objSearcher.Filter = $strFilter

$colResults = $objSearcher.FindOne() 

if ($colResults.Length -eq 1)
{

    $employeeID = $null
    [int32]::TryParse($colResults[0].Properties["EmployeeID"], [ref]$employeeID) | Out-Null

    if ($employeeID -gt 0)
    {

        $svc = New-WebServiceProxy -Uri "http://pods.intranet.company.com/timesheets.asmx?wsdl"

        $hasOutstanding = $svc.hasOutstandingTS($employeeID)
        $hasToApprove = $svc.hasToApproveTS($employeeID)

        if ($hasOutstanding -or $hasToApprove)
     

Open in new window

0
Hi ,

i have working script..
i want to put additional checks in the script to check for files and proceed further.
it should check for files after it checks for source folder.
if all three files available then proceed further to run remaining lines of checking backupfolder.
if even one file is missing or all missing it should write log the missing files and exit

Files names to check-
cat.xml
rat.xml
bat.xml

$logdate=Get-Date -Format ddMMMyyyy_HHmmss
$Logfile = "E:\Logs\FileProcessing_$logdate.txt"

function LogWrite ([string]$logstring)
{  
   Add-content $Logfile -value $logstring
}

#Zip Files
$sourcefolder="E:\INT\PUT"
$backupFolder="E:\INT\Archive"

#check if source exists
if(!(Test-Path $sourcefolder)){
    $msj="The source folder ""$($sourcefolder)"" doesn't exists. Exiting..."
    LogWrite "$( Get-Date -Format "yyyy-MM-dd HH:mm:ss" ) ERROR:`t$msj"
    LogWrite -ForegroundColor Red $msj
    exit -1
}

#check the target folder or create it
if(!(Test-Path $backupFolder)){
    $msj="The target folder ""$($backupFolder)"" was created"
    LogWrite "$( Get-Date -Format "yyyy-MM-dd HH:mm:ss" ) EXECUTE:`t$msj"
    LogWrite -ForegroundColor Magenta $msj
    New-Item -ItemType Directory -Path $backupFolder | Out-Null
}
foreach($file in (Get-ChildItem -File $sourcefolder -Filter "*.xml" -Recurse)){
    $date = Get-date -Format "ddMMyyyy_HHmmss"
    $destinationFile = "$($FILE.Directory.FullName)\$($file.Name).zip"
    $MoveFile = …
0
I want to create a standard menu of options as it were, so that by clicking on a specific area, number, phrase on the menu, that it will trigger a .bat or powershell script to run.
I was hoping for something simple I could copy and paste on any computer, with the expectation that the paths to run the .bat or powershell scripts will have standard locations.
Perhaps and html file (like a web page file), where I could run each script would work, where I could manually add any new scripts etc..
0
looking for power shell Script to Compare Disk Space ,Patches and service status before and after reboot  of windows servers
or if there is any other better solution to do pre-post checks during ms patching
0
Please help to share power shell  script To check last reboot for windows servers (mentioned in server list ) with user id used for reboot
0
When copying files from a NAS toour  new server,  I was testing to copy the files using Robocopy with the following command:

ROBOCOPY <NAS folder> <Destination folder> /S /J /ZB /MIR /DCOPY:DAT /COPY:DATSOU /SECFIX /TIMFIX /MT:48 /R:3 /W:5 /log:log.txt

Afterwards, the administrator does not have access to any of the folders, so I cannot gain access to the folders/files.  If I take ownership it wipes out the original folder owner/permissions.  I looked at using icacls command: icacls <Server Share path>  /grant "Domain Admins":F /t  but it gives an access denied message what I try to add the administrator user.

Should I be using a different approach to copy the files to the new server while adding the administrator user access to the entire directory/file structure?
0
Dear experts

I would like to export the result below to a html format is this possible? Would like to know how. Thanks alot

select A.*, DataFileSizeMB + LogFileSizeMB as TotalSize
from (
SELECT
    DB.name,
    SUM(CASE WHEN type = 0 THEN MF.size * 8 / 1024 ELSE 0 END) AS DataFileSizeMB,
    SUM(CASE WHEN type = 1 THEN MF.size * 8 / 1024 ELSE 0 END) AS LogFileSizeMB
FROM
    sys.master_files MF
    JOIN sys.databases DB ON DB.database_id = MF.database_id
GROUP BY DB.name
) as A
ORDER BY DataFileSizeMB DESC

Open in new window

0
Become a Microsoft Certified Solutions Expert
LVL 12
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Hello Experts,

I need a help I've a batch script for folder locking, in this script I've set a password for folder access after that I convert this batch to exe & give it to users.
Now user wants to create own password & after creating the password once user put password for folder access it should not be appear it should be in form in dot or blank.
Most important thing i want set a default password in case users forget password in that case admin should open that folder from default password, also main folder, sub folder & files which is store in Vault folder should not be find if anyone try to find using windows search.

Script:-

cls
@echo off
mode 50, 10
title   ~Safty Vault~

echo.
(SET OUT=3F)

color %OUT%

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Vault goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Vault "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== password goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Vault
echo Folder Unlocked successfully
0
Hello,
I need to study the following script. What it does and understand it.

SO I am using debug mode in Vscode, but when I click on “Step into”, it is skipping and not going into the next line. Perhaps something is wrong with my VScode?

What is the best way for me to study the script and see what it does? How to manually paste the blocks and study?

So I set the debugger on line 1
When I click the down error Step into, it jumps into the line 206.

For example, I need to understand what does this do? How would I accomplish this with the debugger or manual process. tried copying and pasting and still doesn't understand what it tries to do
gc $sidMappingsFile | foreach {

            $orgShell = $null
            $fields = "","",""
            $fields = $_.ToString().Split(",")

            if ($fields[2] -eq "True") {
                $sourcesid = $fields[0]
                $targetSid = $fields[1]
                $isprimary = $fields[2]
         

Thank you!
0
Hello,

What is the best app for making a .db file as readable as possible?

I use a softphone program called RingCentral Desktop App for PC. The UI it is not my favorite but for the most part, it handles my phone calls and text messaging OK.

Users can view a log of their regular voice phone calls by logging into their RingCentral account online. However, a huge downside of the app, in my opinion, is that there is no way to view/export/download a log of your text messages. It does have a limited SMS search capability but nothing that allows you to specify a date range or search past messages exchanged with more than a single contact at a time.

I've submitted several requests to RingCentral but no solution or workaround has been offered.

I located the file that holds past text messages here:

C:\Users\[username]\AppData\Local\RingCentral\SoftPhone\[phone number]\storage.db

The file size is 6.45 MB.

Out of curiosity I opened the file using Notepad and, as expected, most of the content (6K+ lines) is made up of meaningless symbols. However, two things I did notice are that:

1) the first line begins with "SQLite format 3" (as shown in the following screenshot) which I assume is the language of the database (if a database has a language).

2018-09-08b.png
2) interspersed among the symbols, the file does contain all of the outgoing and incoming text messages (in chronological order) in a readable form as shown in the next screenshot:

2018-09-08c.png
0
Need a script to detect last login for a particular user across all computers. So for example, I have an admin account on the domain named admin1. I'd like to simply scan the domain computers and report back last login for admin1 on all computers.
0
Hi,

I need some assistance in fixing the below PowerShell script that can do the export First.LastName@domain.com.PST from the .CSV input file:

John Hargreave
Linda McCann
Henry Hardy
Vonny Cunard
Kyle Stokes
...

Open in new window


Check if the exported First.LastName@domain.com.PST is already existing on the destination fileserver \\PRODFS01-VM\PST\
if it exists then skip it and append the list  First.LastName@domain.com.PST to a text file.
If not exist, then do the Export to PST as \\PRODFS01-VM\PST\First.LastName@domain.com.PST

$Server = 'PRODFS01-VM'
$ServerBackupUNCPath = "\\$Server\PST\"
$InputCSVPath = 'C:\LOGS\Users.csv'
$ExportCSVPath = 'C:\LOGS\Output.csv'
$ExportExistsCSVPath = 'C:\LOGS\Exist.csv'

Import-PSSession ($Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://PRDEXC03-VM/Powershell/ -Authentication Kerberos)

Get-Content -Path $InputCSVPath |
  Get-MailBox | 
  % {
    Write-Host "Processing .... $($_.Name) ..." -ForegroundColor Green
	
	# Check if the file already exist or not
	$FileResult = Get-WmiObject CIM_DataFile -ComputerName $Server -filter "path='$ServerBackupUNCPath'" | ? {$_.name -match "$($_.Alias).PST" }
	
	if ( $FileResult -eq $null ) {
		#If there is no exported .PST file on the destination folder, then begin the export mailbox command and log if there any error to the AliasName.LOG file:
	    New-MailboxExportRequest -Mailbox $_ -FilePath 

Open in new window

0
Hello Experts,

I am trying to run as administrator a .bat file on a Windows 10 virtual machine remotely via VirtualBox's command line interface. I am controlling the Windows 10 virtual machine via a Linux headless server.

Currently I am using the command:

vboxmanage guestcontrol "win10clean" exec --image "C:/Temp/run.bat" --username localadmin --password *** --verbose --wait-stdout

Output:

Opening guest session as user 'localadmin' ...
Waiting for guest session to start ...
Guest session (ID 13) has been started
Starting guest process ...
Process 'C:/Temp/run.bat' (PID 4592) started

C:\WINDOWS\system32>REG ADD HKLM\Software\Microsoft\Windows\currentversion\explorer\advanced /v Start_PowerButtonAction /t REG_DWORD /d 2 Process terminated
Exit code=1 (Status=500 [successfully terminated])
Closing guest session ...

The VM name is win10clean
The .bat file is called run.bat and is stored on the VM under the path C:/Temp/
The run.bat file is suppose to update a registry value which is why the command must be run as administrator. However the registry value says the same.
1
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
Python 3 Fundamentals
LVL 12
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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

Do we have any script for cold migration of multiple vm from one cluster to another.
0
Hi ,

I need a help.

I have an lightsail instance on aws which is running ubuntu 16.04 LTS with Bitnami LAMP (No gui) .

I use putty to login . Login username will be bitnami and there is no password ,instead of password we use a default-key pair for authentication which was downloaded from aws console.

Now the Problem is my colleague was resigned and he too has the default-pair key .

I either to set password for bitnami so that even if the same key-pair is used the password will get prompted or i want to change the key-pair.

Could someone help me to accomplish this task .

PS:- i tried changing the user bitnami password , but with default pair key login,instance doesnt prompt for the bitnami password.
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.