Category Archives: Scripting

How to run python script on notepad++

How to  Configure Notepad++ to run a python script via python IDLE

If you are learning python and want to use notepad++ as a free as well as simple and easy to use editor, follow these simple steps:

Install python (2.7.x)

First thing: Download the python 2.7.x (current is 2.7.13) windows installer from http://www.python.org/download/ using the default settings. It should install python in the folder: C:\Python27. You can use a different version of python, just substitute out the version number wherever you see 27.

Install Notepad++

Download and install the Notepad++ installer from http://notepad-plus-plus.org/download
Run the installer using the default settings for everything.
Open Notepad++

Configure Notepad++ to run a python script

  1. Open notepad ++
  2. Click run > run or press F5
  3. In the “program to run” dialog box press the three dots (…) and navigate to C:\Python27\Lib\idlelib\idle.py (or change C: to your python installation drive)
  4. Than add “$(FULL_CURRENT_PATH)” after the py so that the line will look like this:

    C:\Python27\Lib\idlelib\idle.py “$(FULL_CURRENT_PATH)”

  5. Click ‘save and give the shortcut a name like ‘python IDLE’
  6. You can also select a shortcut, for example”: Alt+shift+p
    notepad ++ python
  7. Click OK
  8. Click run
  9. A new notepad window will open. (you can minimize the black command line window)
  10. hit F5 and the python shell will now open
  11. In the notepad window, write your code Save as ‘example.py’
  12. hit F5
  13. Now, every time you test your modified code, you will be prompted to save the file. When hit F5 the code will run on the python command line shell, it is a very convenient way to code and simultaneously see your code run.

Create SCCM Distribution Point with Powershell

Hi Sysadmins

You need to create multiple SCCM 2012 Distribution points fast and accurate!

Maybe you decided on upgrading your  environment to SCCM 2012 or your company purchased another organisation. In any case,

The reasonable way will be to use a script, and not use the GUI to do the task over and over.

The preferred scripting environment is Powershell, since it already has many Configuration Manager commandlets that can be helpful.

You do have to work with at least SCCM 2012 sp1 version for the following script to work.

The below Powershell script will read the names of the Distribution points servers from a file. See example for the file Here 

Continue reading “Create SCCM Distribution Point with Powershell” »

How to install IIS features on SCCM 2012 Distribution Point with command line

Hi SysAdmins

Did you ever wonder how SCCM 2012 install a DP remotely from the CM console?

DISM.exe (Deployment Image Servicing and Management tool) is a command line tool that you can use to enable or disable Windows features.

In this case we use it to install all the necessary IIS features for a SCCM 2012 DP.

Command line to install IIS on DPs:

Continue reading “How to install IIS features on SCCM 2012 Distribution Point with command line” »

Copy files to Remote computers using powershell

Hi SysAdmins

In an earlier post I described – How to copy files to domain member computers or servers using Group Policy Object (GPO).

In this post I will show how to copy files to remote computers or servers using a simple Powershell script and .txt file.

728x90_never-forget-password

All you need is:

A txt file that looks like this:

Server1.yourdomain.com
Server2.yourdomain.com
Server3.yourdomain.com
and so on…

You can use IP addresses as well.

And this piece of Powershell code:


$ServerList = Get-Content "C:\ServersList.txt" #Change this to location of servers list
$SourceFileLocation =  #For example: D:\FoldertoCopy\ or D:\file.txt
$Destination =  #Example: C$\temp

foreach ($_ in $ServerList)
 {Copy-Item $SourceFileLocation -Destination \\$_\$Destination -Recurse -PassThru}

Save the above code as CopyFilestoservers.ps1, and your servers list as ServersList.txt

You will need Write permissions on the remote machines to run the script successfully.

How to Retrieve a Password of an Application Pool User in IIS 6

Today I needed to set a SPN for a IIS application. I discovered that I lost the password of the user account which I need to configure on the application pool.

Luckily, there is a way to retrieve/decrypt the password if it is configured on an existing Application Pool.

This is done by using a Microsoft tool on the IIS server – adsutil.vbs.

Here are 5 simple steps to do this:

Continue reading “How to Retrieve a Password of an Application Pool User in IIS 6” »

The Silent Ping Command

The “Silent Ping” Command is a sort of improvement for the well known ping command.

So, why do we need it?

When you reboot a serve or PC remotely, you can never be sure when it was booted again or when it is online again,

Most people use the ping command with the -t parameter to check if a server is online again.

But what if you could know exactly when a server is up again or even simply monitor a server when it goes offline over the night,

Or if a communication error occurs that cause some kind of service outage.

Continue reading “The Silent Ping Command” »

Create multiple site boundaries in sccm 2007

Hi Again

Recently I was puzzled by a tedious task. I needed to create 300+ site boundaries in SCCM 2007.

Obviously this task should be automated by some kind of a tool. but Microsoft doesn’t give such a tool.

So I searched the internet and found a nice script at this iste.

the script did not work at first so I modified it for my own needs to produce the needed result.

Continue reading “Create multiple site boundaries in sccm 2007” »

How to Add Hebrew to Powershell or Command (CMD) Console

Hi SysAdmins

Did you ever ran into a situation where you need to add a foreign language to the powershell or Command console? let’s say for script output purpose.

It seems that the process of adding Non-Latin characters is not widely documented.

In this example I will demonstrate how to add Hebrew writing to Powershell. This will also affect the Command (CMD) console.

Continue reading “How to Add Hebrew to Powershell or Command (CMD) Console” »

How to find the system uptime in Windows XP/2003/Vista/2008

Hi SysAdmins

It is very useful to know how many days are your system up and online. Especialy in windows OS.

There are several ways to find the system uptime in Windows XP and above:

Using Systeminfo command:

This command-line utility shows the time that the system was booted and its running time.

Continue reading “How to find the system uptime in Windows XP/2003/Vista/2008” »

Killing a stuck Windows Service

Hi

I guess all of us met the phenomenon when a service refuses to stop and stuck on “Stopping” status.

well, there is a remedy to this by following this short procedure:

1. Identify the PID of the rogue service. open cmd and type: sc queryex

you will receive a long list of available services. you can also type sc queryex > c:\ServiceList.txt to send the output to a text file.

Continue reading “Killing a stuck Windows Service” »