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

Hi,

I have a list of servers names in a csv file and I would like to get their IP Address and see if they respond to a ping.

How can I do that with PowerShell?

Thanks
0
Introduction to Web Design
LVL 19
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.

We need to Migrate Windows 2000 Server on vSphere 6.5

Existing Windows 2000 is a Physical Server , How can we migrate this to VM using VM converter supported version for 6.5?

What should be best approach to get it migrated to VM on my vSphere 6.5


Thanks!
0
How to connect to a another domain from code so i can execute AD command-lets. Can i include the credentials withing the code ?
I know i have to include the Import-Module ActiveDirectory

Thank for your help,
0
Hello experts,

I used the following hotstring in my AutoHotkey/Hotstring file:
#G::
#!G::
#!R::
They also refer to keyboard shortcuts of Xbox Game, coming as default with Win10.
https://support.microsoft.com/en-us/help/4026387/windows-10-keyboard-shortcuts-for-xbox-game-bar
I don't use Xbox as a result I would like to get ride off them.
When I call the AutoHotkeys related to them, I also activate Xbox shortcuts, behavior that I want to avoid.
Normally this is not the case for the other applications as AutoHotkey surpass other default shortcuts and turn them off.

If you have advice and recommendations on how to manage this and also if you have some feedback and best practices on how to avoid hotstrings and keyboards conflicts, please let me know.

Thank you very much for your help.
0
Send Message Command to remote computer.

I would like to run the Send Message command from one windows computer to another windows computer, and have the message shows up on another computer screen  even if it is locked

Thank you
0
how to get help  in Powershell  while writing commands.

when writing commands in windows there is always the "/?" ,  to see what can come after the last typed command.
example :
C:\>wmic /?

WMIC is deprecated.

[global switches] <command>

The following global switches are available:
/NAMESPACE           Path for the namespace the alias operate against.
/ROLE                Path for the role containing the alias definitions.
/NODE                Servers the alias will operate against.
/IMPLEVEL            Client impersonation level.
/AUTHLEVEL           Client authentication level.
/LOCALE              Language id the client should use.
/PRIVILEGES          Enable or disable all privileges.

Open in new window


then you type for example :

C:\>wmic  bios /?

BIOS - Basic input/output services (BIOS) management.

HINT: BNF for Alias usage.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>].

USAGE:

BIOS ASSOC [<format specifier>]
BIOS CREATE <assign list>
BIOS DELETE
BIOS GET [<property list>] [<get switches>]
BIOS LIST [<list format>] [<list switches>]

Open in new window


then you can type:
C:\>wmic  bios  get /?

Property get operations.
USAGE:

GET [<property list>] [<get switches>]
NOTE: <property list> ::= <property name> | <property name>,  <property list>

The following properties are available:
Property                                Type                    Operation
========                                ====                    =========
BiosCharacteristics                     N/A                     N/A
BuildNumber                             N/A                     N/A
CodeSet                                 N/A                     N/A
CurrentLanguage                         N/A                     N/A
Description                             N/A                     N/A
IdentificationCode                      N/A                     N/A
InstallDate                             N/A                     N/A
InstallableLanguages                    N/A                     N/A
LanguageEdition                         N/A                     N/A
ListOfLanguages                         N/A                     N/A
Manufacturer                            N/A                     N/A
Name                                    N/A                     N/A

Open in new window


Until you find the parameters you need to compose the Full command.

in Powershell , I do not see the help as long as you are type the command ... I wonder if there is anyway  to find that help similar to writing commands in Windows CLI as the examples I  cited above ?

Thank you
0
Hi, i have code that read 12 SQL Servers, every server has a C drive and a D Drive. The C drive is under GB and the D drive is under TB.  And I am focusing on the D Drive. The script creates a report with the following headers:  "Servername","Drive","Total size (TB)","Free Space (TB)","Free Space (%)","Name ".
But the metrics for the C drive do not make sense, because i do the calculation for TB, the D drive.

Is there any to show GB and TB respectively for each Drive ?
Or, can I remove the C drive from the report ?
Lastly, can i add the contents of the report in the body of an email and send the report as an attachment ?

Code:
$computers = Import-CSV "C:\Scripts\HardDriveSpace\PROD-SQLBAK-Servers.csv"
foreach ($Computer in $Computers){  
	$Server =  $Computer.Name
	$ServerOS = Get-ADComputer $Server -Properties * | Select OperatingSystem
	Write-Host "Hostname: $Server OS:"($ServerOS).OperatingSystem""
	If ((Test-Connection -ComputerName $Server -Quiet) -and (($ServerOS).OperatingSystem -notin "unknown", "Ubuntu", "")) {
        try{
		    $Disks = Get-wmiobject -Class Win32_LogicalDisk -computername $Server -ErrorAction SilentlyContinue -filter "DriveType= 3"
		}
		Catch{
            $ErrorMessage = $_.Exception.Message
			$FailedItem = $_.Exception.ItemName
			Write-Warning "Failed to get Drives information from $Server"
			Write-Host "Sleeping"
			Start-Sleep 5
		}
	    Try {
		    $Servername = (Get-wmiobject CIM_ComputerSystem -ComputerName $Server 

Open in new window

1
Hello,

I already have a basic VS script that sends emails but I am looking for some help on how to embed data from a text file in the body of the email message.

Example of the type data in the text file is attached.

Sample File
Hello,
0
Need help to update this Autohotkey script to add the hour, minute and second to the generated result.  

If possible, prefer AM & PM.  If not, then 24-hour format is fine:

^#q::
FormatTime, CurrentDateTime,, yyyy.M.d-'A'
SendInput %CurrentDateTime%
return

Open in new window


Amy thanks!

OT
0
Hello Powershell Community. I have been giving the task of editing the extensionAttribute1-10 Fields for a group of users. I am not sure how the data will look for the group of users that will be sent over to me but it will be in CSV format and hopefully contain the samAccountName. If so i have put together this powershell script that i have tested to work to alter the value in the extensionAttribute field but my question is how can i ammend an import-csv command to run through a list of users (For-Each User in Users) so that i can feed this script multiple users using a CSV file that will contain their samAccountnames in coloumn 1. I hope this makes sense. Please view attached jpg. Obviously i would not be using the read-host cmdlet for bulk editing. Any ideas?

$NewUser = read-host "Please enter users UPN?"
$NewUser | Set-Aduser -Replace @{extensionAttribute1="Field Support Center"}

Open in new window



Powershell-Attribute-Changer.jpg
If the CSV file that is imported from Workday does not contain the samAccountname is there a way of extracting the SAM from the email address?
1
CompTIA Network+
LVL 19
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

What is the best way to search many times in a csv file with PowerShell?

For example:

I have 2 csv files: AD-USers.csv and InActive-Users.csv

PowerShell algorithm should look like this:

1- Search each AD users from AD-USers.csv

2- Check if AD user is not exists in InActive-Users.csv  then

3- Add in AD user in new csv: Active-AD-Users.csv
1
Hello experts,

Following the question:
https://www.experts-exchange.com/questions/29162274/AutoHotkey-eject-usb.html


I would like to review the specs :

1.      Instead of entering the letter to eject specific USB drivers, I would like to have a single AutoHotkey shortcut key to eject all the connected USB drivers available in my computer.
2.      Remove the part related to access the USB drivers.

I attached last proposed solution.

If you have questions, please contact me.

Thank you for your help.
EjectDriveV2.ahk.txt
0
Facing issues with PowerCLI Script automated though Scheduled task on OS Win 2016

Earlier it was all fine now days getting multiple errors failing script execution

Installed Power shell and PowerCli versions are ...
PowerCLI Version
----------------
   VMware PowerCLI 11.3.0 build 13990089
---------------
Component Versions
---------------
   VMware Cis Core PowerCLI Component PowerCLI Component 11.3 build 13964830
   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.3 build 13964826

PowerShell is 5.1

 And frequent error is
Connect-VIServer : Could not load file or assembly 'VMware.Vim, Version=6.7.0.2048, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the
file specified
I want to execute my script for vSphere 5.5 and 6.5 Health check

Please help to get this fixed
 did tried reinstall /removal of existing powercli module/vmware module etc -but no success
0
Hello experts,

I was wondering if there is a way to set up a AutoHotkey key to eject usb.

Thank you for your help.
0
Hi,

I run this PowerShell script:


------------------------------------------------------------------------------------------------
Import-Module ActiveDirectory

$Users = Import-csv -path "C:\Temps\Users.csv"


$Users | % {

    Write-host $_.Users  $_.Manager

    Try{

        Set-ADUser -Identity $_.Users -Manager $_.Manager
    }
    catch{
   
       Write-host "Users: $($_.Users)"
   
    }
}


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


The result is like:

john    robert
eric
Users:


I know the value of eric manager is empty that why the catch give: "Users:"

But why the catch gives just "Users:" and not "Users: eric"? This should contain:  $_.Users
0
Learn Python instead of Powershell

I have read that python has modules that enable someone to interact with Active Directory , Exchange and MS Office products and use python scripts just like Powershell.

So Now , if that's the case why should I learn both Python and Powershell, instead of only Python, as this latter is also used in so many areas , such as web development , networking and Databases,etc...

in other words, is it waste of time learning Powershell , if Python is able to accomplish the same thing and more ?

Thank you
0
Which Powershell should I learn ?

I have read that learning Powershell will make sysAdmins lives easier. However when I watched some videos about Powershell, I found out that you can learn Powershell commands and script just in a scope that you are working in.  For instance, if you are using a lot of Active Directory , there are a set of commands related just to Active Directory, the same applies for MS Exchange , and manipulating text,CSV files. If you are using VMware, you will be doing completely different type of Powershell which is called Powercli ...So to conclude what I have stated , it is not easy to know Powershell and use it for everything (Active Directory, Exchange,Text Files,CSV Files, Vmware).

* I also would like to ask whether using Powershell , will enable sysadmin to add customized tabs, to Active Directory objects ?

any insight is welcomed ?

Thank you
1
Hi Experts,

I need help with this script, if this is possible.  What I have is a script that pulls from a list of computers in a inline loop, for each computer, this connects to remotely then:

1) runs a sccm advertisement
2) monitors processes in a loop
3) when processes finish running, computer is rebooted.
Currently have it sending a email when rebooting.

What I need help with - is there a way to have this sequence take place FIVE TIMES on each computer, so a loop in the loop?  Then send a email after the 5th time only?

The purpose is to install updates on a computer with the SCCM advertisement, but when only doing this one, cumulative updates need to be installed, so this has to be run an average of 5 times to get all of the updates.

Thanks in advance for any help.

workflow foreachrerun {
    param([string[]]$computers)
    foreach –parallel ($computer in $computers) {
       InlineScript {

Function Start-CCMRerunAdvertisement {

    [CmdLetBinding()]Param(
        [Parameter(Mandatory=$true)][string]$computerName,
        [Parameter(Mandatory=$false)][string]$advertisementId = "*",
        [Parameter(Mandatory=$false)][string]$packageId = "*",
        [Parameter(Mandatory=$false)][int]$maxRun = 1
        #[Parameters(Mandatory=$false)][switch]$moreThanPing = $false
    )

    if($advertisementId -eq "*" -and $packageId -eq "*") {
        Write-Error "You must supply either an AdvertisementID or a PackageID"
        return "Missing 

Open in new window

0
Hi,

Is there a good tool to convert PowerShell script to a exe file?

Thanks
1
Python 3 Fundamentals
LVL 19
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.

SQL - Database snapshot.

Is there away to refresh snapshot database without dropping snapshot?
 
Today I was trying to add ldap group account to database snapshot without success.  I did want to drop source database because we only doing database refreshes at night.

So is there a query that can run against snapshot database to add domain group accounts?
0
Hi,

Is there a way to list the properties attribute in PowerShell?

Example: Get-AdUser user01 -properties...

I need to know which properties attributes existed. Is there a quick trick to list them?

Thanks
1
Hi,

In this Powershell cmd:

Get-AdUser -Identity $user

How can I make PowerShell prompt asking for user name? I want user provides the info about identity in variable.
1
Dear expert

In powershell, is it possible to invoke a variable in a variable? For exemple: $flower = ($color = "Red", leaf = "4", $weight = "50g") ?

Regards
Wei
1
ReactReduxCodeFile.rtfI'm a total react/redux newbie; I have a react/redux app that loads a page based on 2 sets of select boxes; When user makes selection, the dispatch event happens and immediately a spinning loader icon is displayed which displays until all the data is loaded. Somewhere in the attached file code, that part is not working. Any help is appreciated.
0
Hi Experts,

I've been working on this powershell script and need some help with a couple of things.  The script will be called from this vbscript to pass the computername or listofcomputers variables.

What I'd like expertise or help with is:

1. I've tested calling this from the VBScript Code in top comments section, but didn't get the computername variable to pass down.  (this would be done from the vbscript above, but wanted just a test wrapper to test).  EDIT:  If this is too difficult, I'd like to set it up to pull from a list of computers.

2. I'm first running "Test-MyConnection" (if) the computer is online, I'm then calling a executable.exe.  This is the part I'm having issues with - I don't necessarily want to run a .exe here, but call an SCCM advert (pasted below from client center), or, I also have a vbscript that runs the advert I could call out to.  This advert would exist locally on every computer.  The part I'm unsure about, or how to code is having this advert run on each computer in the list of variables


SCCM Advert Code:
 get-wmiobject -query "SELECT * FROM CCM_Scheduler_ScheduledMessage WHERE ScheduledMessageID='SCCM00001-SCCM00002-5D2960FE'" -namespace "ROOT\ccm\policy\machine\actualconfig"
 

Open in new window

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.