background preloader

Powershell Scripts, Tips and Resources

Powershell Scripts, Tips and Resources

PowerShell Introduction PowerShell est un langage de script et un shell interactif offrant une manière de traiter des tâches orientée commande. Les concepteurs ont suivi différentes approches afin que PowerShell soit : aussi interactif et composable que KSH ou BASH, aussi programmable que PERL ou RUBY, aussi orienté-production que VMS DCL ou AS400 CL. PowerShell est compatible avec les précédents langages de scripting. En règle générale, PowerShell exécute toutes les commandes et scripts existants. PowerShell n'interprète pas les fichiers .bat ou .cmd, il les dirige vers cmd.exe pour les exécuter. La modification de variables d'environnements dans un script .cmd afin d'affecter l'exécution d'autres scripts n'est pas supportée dans PowerShell et c'est la seule incompatibilité à ce niveau. PowerShell facilitera les tâches d'administration telles que la gestion du paramétrage des composants système imprimante, réseaux, IE, la création de comptes utilisateurs et les opérations associées... 3-1. 3-1-1. 3-2. 3-2-1.

SharePoint 2010, PowerShell what’s the deal? « Cody's Powershell Blog If you love PowerShell as much as I do, you should be aware of how SharePoint 2010 takes full advantage of PowerShell. Over the past few months, I’ve been giving a presentation on managing SharePoint 2010 with PowerShell. It surprised me that the majority of people aren’t taking advantage of PowerShell or they don’t realize the benefits of learning PowerShell. Now that we have PowerShell open, type the following command Don’t worry about the exact syntax of the command, we will go into this later. To use the Get-Help cmdlet, you type Get-Help and then the Cmdlet you want to learn more about. The information provided by Get-Help is very useful . The above command is using the “examples” parameter to return examples on how to use the Get-SPSite cmdlet. The above command will give us the tons and tons of information on the Get-SPSite cmdlet. Like this: Like Loading...

PowerShell Magazine Introduction au développement PowerShell Partie I Auteur : Eric Vernié, responsable technique en charge des relations développeurs Document de référence Révision 1.0 Téléchargement Téléchargez les sources Pré-requis Introduction Introduction au langage de script de Powershell Consommer un composant .NET avec Powershell Développer une extension à powershell (CmdLet) Modification du profile pour installer les cmdlets Utilisation d'une cmdlet pour construire et consommer un service Web à la volée Conclusion Ressources Pré-requis Avant d'aller plus loin, il est important que lecteur ait des notions de développement avec la plate-forme .NET.ait installé Windows PowerShell Visual Studio 2005 sous la main. Introduction Windows Powershell™ est un nouvel environnement de ligne de commande Windows spécialement conçu pour les administrateurs système. Pour bien comprendre la philosophie de Windows Powershell, il est important de connaitre deux principes fondamentaux.

SharePoint & PowerShell 101: Finding Cmdlets « Geoff Varosky's Blog I recently did a post on Listing all available PowerShell commands in SharePoint 2010. That is all well and good, if you want to manually browse through all of them. But what if you want to search for them? Get-Command Get-Command is a highly useful cmdlet in PowerShell. Get-Help Get-Command Which will return the following information about the cmdlet This will return the usage of the Get-Command cmdlet. Let’s start looking at the basics… we’re looking to find commands relating to the User Profile Service. Get-Command –Noun Profile Nothing is returned… oh right, it would appear that the Get-Command is literal, not a wildcard. Get-Command –Noun *Profile* Hooray, results! Fore information on using that, try this in the PowerShell consoleGet-Help Select-Object So, let’s only pull the Name property in our results of the Get-Command Get-Command -Noun *Profile* | Select-Object –Property Name Much better! Get-Command -Noun *ProfileService* | Select-Object -Property Name And there we go! Like this:

Running Multiple Batch Files Together in Parallel Recently I was preparing a demo for my next technical session, I had to do run a SQL code in parallel. I decided to use Batch File to run the code. I am not the best guy to with command shell so I did it with following setup. Code of tsql.sql SELECT 1 ColumnName Code of command.bat sqlcmd -S . Code of AllBatch.bat start cmd.exe /C “command.bat” start cmd.exe /C “command.bat” start cmd.exe /C “command.bat” Now I ran AllBatch.bat and it run all the three files in parallel and simulated my needed scenario. I believe there should be simpler way using power-shell. Reference: Pinal Dave ( Like this: Like Loading...

Parallel batch jobs This section describes parallel batch jobs, giving examples of batch job scripts, and interactive PBS sessions. See section Submitting jobs: qsub for information about the qsub command and section Job launching command: aprun for information about the aprun command. Their arguments and usage are described on these pages. See also section Commands for other PBS commands. The batch job script named ad job.sh can be submitted by the command qsub job.sh You can use also the options of qsub in the command line or in the batch job script. Job script for quad- and eight-core mode The normal and recommended mode is to use all four cores on each node (XT4 node queues) or all eight cores on each node (XT5 node queues), that is 4 PEs is default for XT4 nodes and 8 PEs for XT5 nodes. #! #PBS -M user1@univ2.fi#PBS -r n cd $PBS_O_WORKDIRaprun -n 256 . Suppose that the name of this batch job script is job.sh. However, you don't know in advance is your job going to XT4 or XT5 queues. aprun -n 256 -N 4 . ... #!

Related: