DOAG 2011 DP Tricks-1



Similar documents
Introduction to PowerShell by Guy Thomas

PowerShell for Exchange Admins

Exploring PowerShell. Using Windows PowerShell

Acknowledgments Finding Your Way Around Windows PowerShell p. 1 Getting Started with Windows PowerShell p. 3 Installing Windows PowerShell p.

WolfTech Active Directory: PowerShell

SUNGARD SUMMIT 2007 sungardsummit.com 1. Microsoft PowerShell. Presented by: Jeff Modzel. March 22, 2007 Course ID 453. A Community of Learning

Lab Sample Solutions. Chapter 3

Microsoft. Jump Start. M3: Managing Windows Server 2012 by Using Windows PowerShell 3.0

Windows Server 2008 R2: Server Management and PowerShell V2

# Demo: jak to działa?

A layman s guide to PowerShell 2.0 remoting. Ravikanth Chaganti

mspsug-meeting txt

Jeffrey Snover Distinguished Engineer & Lead Architect Jason Helmick Senior Technologist, Concentrated Technology

Windows PowerShell 2.0

Things I wish I d known when I started using PowerShell

Effective Windows PowerShell. Grok Windows PowerShell and Get More From It.

POWERSHELL FOR NEWBIES Getting started with PowerShell 4.0. Jeffery Hicks

Windows PowerShell Fundamentals

How To Use Powerpoint In Windows Powerpoint (Windows Powerpoint)

Unidesk 3.0 Script to Increase UEP Size for Persistent Desktops

POWERSHELL (& SHAREPOINT) This ain t your momma s command line!

Wireshark Developer and User Conference

ICT dag 03/12 Managing Systems with PowerShell. Bart Portier docent TW KHK Geel Microsoft Certified Trainer

Question: Hi Everyone! Thank you TEACHERS, MICROSOFT, MVA and Event Support Team for this lesson! Answer: Great to see you POPA DAN!

Windows PowerShell. 3.0 Step by Step. Ed Wilson

Tools & Techniques for Remote Help Desk Support

The Windows PowerShell Owner s Manual: Version 2.0. Jean Ross and Greg Stemp Microsoft Communications Server UA

Forefront Management Shell PowerShell Management of Forefront Server Products

Command Line Crash Course For Unix

You Should Be Using PowerShell Aaron Kaiser Senior Technology Support Specialist Parkway School District

Windows PowerShell Essentials

Building an Architecture Model Entwerfen Sie mit AxiomSys ein Kontextdiagramm, das folgendermaßen aussieht:

Implementing Multi-machine Monitoring

ISCSI Server Installation

Resco Mobile CRM Woodford (Rules Guide) Document version

LECTURE-7. Introduction to DOS. Introduction to UNIX/LINUX OS. Introduction to Windows. Topics:

Linux & Docker auf Azure

VirtualSchool Office365 Lizenzen zuweisen Feb 2013

PowerShell Tutorial. Eigil Obrestad and Erik Hjelmås. August 18, 2015

Microsoft Nano Server «Tuva» Rinon Belegu

Using Windows PowerShell to Manage SharePoint 2010

ActiveRoles Management Shell for Active Directory

An A-Z Index of the Apple OS X command line (TERMINAL) The tcsh command shell of Darwin (the open source core of OSX)

Helfen Sie Apple, Produkte und Dienste zu verbessern, indem Sie Diagnose- und Nutzungsdaten über icloud senden.

Automating. Administration. Microsoft SharePoint with Windows. PowerShell 2.0. Gary Lapointe Shannon Bray. Wiley Publishing, Inc.

Brauche neues Power Supply

REST API Getting Started Guide

Checklist Use this checklist to find out how much English you already know. Grundstufe 1 (Common European Framework: A1 Level)

Thirty Useful Unix Commands

Clouds. Windows Server 2012 Release Candidate. Server Management

CS 103 Lab Linux and Virtual Machines

Linux command line. An introduction to the Linux command line for genomics. Susan Fairley

Tutorial 0A Programming on the command line

Is Cloud relevant for SOA? Corsin Decurtins

An Introduction to the Linux Command Shell For Beginners

Command Line - Part 1

Lab Answer Key for Module 1: Installing and Configuring Windows Server Table of Contents Lab 1: Configuring Windows Server

I-Q SCHACHT & KOLLEGEN QUALITÄTSKONSTRUKTION GMBH ISO 26262:2011. Liste der Work Products aus der Norm

PowerShell for Dummies

LEARNING AGREEMENT FOR STUDIES

SPICE auf der Überholspur. Vergleich von ISO (TR) und Automotive SPICE

WHITE PAPER POWERSHELL FOR DUMMIES HOW TO KEEP TRACK OF

Automating Microsoft SQL Server 2012 Deployment and Storage Provisioning

Command-Line Operations : The Shell. Don't fear the command line...

Virtualization Hyper-V host scale and scale-up workload support

A CIP catalogue record for this book is available from the British Library.

Server Manageability and Automation

5/13/2009. Dejan Foro Speaker

Windows Server und Windows Vista-Gruppenrichtlinien

Software / FileMaker / Plug-Ins Mailit 6 for FileMaker 10-13

LSN 10 Linux Overview

Programming for GCSE Topic H: Operating Systems

J2EE-Application Server

Application example AC500 Scalable PLC for Individual Automation Communication between AC500 and KNX network abb

Upgrading Your Skills to MCSA Windows Server 2012 MOC 20417

Upgrade-Preisliste. Upgrade Price List

Symantec Backup Exec (TM) 13 Installation Log

cmshell for SAP CommandLets for SAP GUIScripting SAP GUI Scripting connmove GmbH Version: 0.7 Seite 1 von 15

Learn Windows PowerShell in a Month of Lunches

Migrating/Upgrading to Oracle Version 8.1.5: UNIX (BC-DB- ORA

Automating Tasks Using PowerShell Scripting

Linux System Administration on Red Hat

1.- L a m e j o r o p c ió n e s c l o na r e l d i s co ( s e e x p li c a r á d es p u é s ).

CommVault Simpana 7.0 Software Suite. und ORACLE Momentaufnahme. Robert Romanski Channel SE

:09: [scheduler thread(5)]: AdvancedCardAllocation.GetAvailableCardsForChannel took 7 msec

Windows Server 2008 R2: What's New in Active Directory

Windows 7 Portable Command Guide: MOTS , and MCITP

Search Engines Chapter 2 Architecture Felix Naumann

Information Systems 2

VB.NET - DATE & TIME

NetWorker - Allgemein Tip 400, Seite 2/ / cr

Fred Hantelmann LINUX. Start-up Guide. A self-contained introduction. With 57 Figures. Springer

5 HDFS - Hadoop Distributed System

Windows PowerShell: A First L k. Charlotte McGary

USEFUL UNIX COMMANDS

Konnte die Datei Hotsync.log nicht öffnen. Folgender Fehler wurde zurückgegeben: File Not Found

OS9 UNIX help man chd cd del rm copy cp makdir mkdir OS9 is case sensitive!! attr chmod deldir rmdir pd pwd list more

Windows Server 2012 R2 Storage Infrastructure


Transcription:

DOAG 2011 DP Tricks-1

DOAG 2011 DP Tricks - 2

DOAG 2011 DP Tricks-3

DOAG 2011 DP Tricks-4

Aufrufsyntax: PowerShell[.exe] [-PSConsoleFile <Datei> -Version <Version>] [-NoLogo] [-NoExit] [-Sta] [-NoProfile] [-NonInteractive] [-InputFormat {Text XML}] [-OutputFormat {Text XML}] [-WindowStyle <style>] [-EncodedCommand <Base64EncodedCommand>] [-File <Dateipfad> <Argumente>] [-ExecutionPolicy <ExecutionPolicy>] [-Command { - <script-block> [-args <arg-array>] <string> [<CommandParameters>] } ] PowerShell[.exe] -Help -? /? REM Powershell Pack Erweiterungspack http://archive.msdn.microsoft.com/powershellpack/release/projectreleases.aspx?releaseid=3341 WPK Create rich user interfaces quick and easily from Windows PowerShell. Think HTA, but easy. Over 600 scripts to help you build quick user interfaces TaskScheduler List scheduled tasks, create or delete tasks FileSystem Monitor files and folders, check for duplicate files, and check disk space IsePack Supercharge your scripting in the Integrated Scripting Environment with over 35 shortcuts DotNet Explore loaded types, find commands that can work with a type, and explore how you can use PowerShell, DotNet and COM together PSImageTools Convert, rotate, scale, and crop images and get image metadata PSRSS Harness the FeedStore from PowerShell PSSystemTools Get Operating System or Hardware Information PSUserTools Get the users on a system, check for elevation, and startprocessaadministrator PSCodeGen Generates PowerShell scripts, C# code, and P/Invoke DOAG 2011 DP Tricks-5

DOAG 2011 DP Tricks-6

DOAG 2011 DP Tricks-7

Ausgabe von get-date get-member: Name MemberType Definition ---- ---------- ---------- Add Method System.DateTime Add(System.TimeSpan value) AddDays Method System.DateTime AddDays(double value) AddHours Method System.DateTime AddHours(double value) AddMilliseconds Method System.DateTime AddMilliseconds(double value) AddMinutes Method System.DateTime AddMinutes(double value) AddMonths Method System.DateTime AddMonths(int months) AddSeconds Method System.DateTime AddSeconds(double value) AddTicks Method System.DateTime AddTicks(long value) AddYears Method System.DateTime AddYears(int value) CompareTo Method int CompareTo(System.Object value), int CompareTo(System.DateTime value) Equals Method bool Equals(System.Object value), bool Equals(System.DateTime value) GetDateTimeFormats Method string[] GetDateTimeFormats(), string[] GetDateTimeFormats(System.IFormatProvider provider), string[... GetHashCode Method int GetHashCode() GetType Method type GetType() GetTypeCode Method System.TypeCode GetTypeCode() IsDaylightSavingTime Method bool IsDaylightSavingTime() Subtract Method System.TimeSpan Subtract(System.DateTime value), System.DateTime Subtract(System.TimeSpan value) ToBinary Method long ToBinary() ToFileTime Method long ToFileTime() ToFileTimeUtc Method long ToFileTimeUtc() ToLocalTime Method System.DateTime ToLocalTime() ToLongDateString Method string ToLongDateString() DOAG 2011 DP Tricks-8

Fortsetzung der Ausgabe von get-date get-member: ToLongTimeString Method string ToLongTimeString() ToOADate Method double ToOADate() ToShortDateString Method string ToShortDateString() ToShortTimeString Method string ToShortTimeString() ToString Method string ToString(), string ToString(string format), string ToString(System.IFormatProvider provider),... ToUniversalTime Method System.DateTime ToUniversalTime() DisplayHint NoteProperty Microsoft.PowerShell.Commands.DisplayHintType DisplayHint=DateTime Date Property System.DateTime Date {get;} Day Property System.Int32 Day {get;} DayOfWeek Property System.DayOfWeek DayOfWeek {get;} DayOfYear Property System.Int32 DayOfYear {get;} Hour Property System.Int32 Hour {get;} Kind Property System.DateTimeKind Kind {get;} Millisecond Property System.Int32 Millisecond {get;} Minute Property System.Int32 Minute {get;} Month Property System.Int32 Month {get;} Second Property System.Int32 Second {get;} Ticks Property System.Int64 Ticks {get;} TimeOfDay Property System.TimeSpan TimeOfDay {get;} Year Property System.Int32 Year {get;} DateTime ScriptProperty System.Object DateTime {get=if ((& { Set-StrictMode -Version 1; $this.displayhint }) -ieq "Date")... DOAG 2011 DP Tricks-9

DOAG 2011 DP Tricks-10

DOAG 2011 DP Tricks-11

DOAG 2011 DP Tricks-12

DOAG 2011 DP Tricks-13

DOAG 2011 DP Tricks-14

get-itemproperty -path $OH PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Oracle\KEY_Or adb11g_home1 PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Oracle PSChildName : KEY_OraDb11g_home1 PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry ORACLE_HOME : D:\oracle\product\11.2.0\dbhome_1 ORACLE_HOME_NAME : OraDb11g_home1 ORACLE_GROUP_NAME : Oracle - OraDb11g_home1 NLS_LANG : GERMAN_GERMANY.WE8MSWIN1252 ORACLE_BUNDLE_NAME : Enterprise OLEDB : D:\oracle\product\11.2.0\dbhome_1\oledb\mesg ORAMTS_CP_TRACE_LEVEL : 0.. ORACLE_SID :o11g MSHELP_TOOLS :D:\oracle\product\11.2.0\dbhome_1\MSHELP SQLPATH :D:\oracle\product\11.2.0\dbhome_1\dbs ORACLE_HOME_KEY : SOFTWARE\ORACLE\KEY_OraDb11g_home1 ORACLE_BASE : D:\oracle RDBMS_CONTROL :D:\oracle\product\11.2.0\dbhome_1\DATABASE RDBMS_ARCHIVE D:\oracle\product\11.2.0\dbhome_1\DATABASE\ARCHIVE ORA_O112_AUTOSTART : TRUE ORA_O112_SHUTDOWN : TRUE ORA_O112_SHUTDOWNTYPE : immediate ORA_O112_SHUTDOWN_TIMEOUT : 90 ORA_O11G_AUTOSTART : TRUE ORA_O11G_SHUTDOWN : TRUE ORA_O11G_SHUTDOWNTYPE : immediate ORA_O11G_SHUTDOWN_TIMEOUT : 90 DOAG 2011 DP Tricks-15

DOAG 2011 DP Tricks-16

Beispiel: Anzeige der Oracle Services die auf Automatisch stehen, aber nicht gestartet sind: Get-WmiObject Win32_Service Where-Object { $_.StartMode -eq 'Auto' -and $_.State -ne 'Running' -and $_.Name -match "Ora"} ft auto DOAG 2011 DP Tricks-17

Hinweis: Folgende Stati der Instanz bringen diese Meldungen zurück: REM Shutdown in Progress Fehler ORA-01089: immediate shutdown in progress - no operations are permitted REM Shutdown Mode: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist REM Mount: ORA-01033: ORACLE initialization or shutdown in progress REM Open: ORA-28000: the account is locked DOAG 2011 DP Tricks-18

DOAG 2011 DP Tricks-19

DOAG 2011 DP Tricks-20

Die fünf Prozesse mit der größten Speicherauslastung anzeigen: get-process sort-object -property WS select-object -Last 5 DOAG 2011 DP Tricks-21

DOAG 2011 DP Tricks-22

Hinweis: Wenn Sie auch Attachments verschicken möchten: $msg = new-object Net.Mail.MailMessage $smtp = new-object Net.Mail.SmtpClient($smtpServer) $msg.from = "m.patzwahl@muniqsoft.de" $msg.to.add ("m.patzwahl@muniqsoft.de") $msg.subject = "Nachricht mit Anhängen" $msg.body = "Hier könnte Ihr Body stehen" # Alle Dateien des Ordners C:\temp\att anhängen foreach ($file in gci "c:\temp\att"){ $att = New-Object Net.Mail.Attachment($file.fullname) $msg.attachments.add($att) } $smtp.send($msg) DOAG 2011 DP Tricks-23

Beispielausgabe von: Get-Process select name,cpu,threads ft -auto DOAG 2011 DP Tricks-24

Beispielausgabe: #TYPE System.Diagnostics.EventLogEntry#System/Service Control Manager/3221232472 "EventID","MachineName","Data","Index","Category","CategoryNumb er","entrytype","message","source","replacementstrings","instan ceid","timegenerated","timewritten","username","site","containe r" "7000","goofymarco.muniqsoft.de","System.Byte[]","91701","(0)", "0","Error","Der Dienst ""CyberLink UDF Filesystem"" wurde aufgrund folgenden Fehlers nicht gestartet: %%1275","Service Control Manager","System.String[]","3221232472","19.01.2012 07:48:24","19.01.2012 07:48:24",,, " DOAG 2011 DP Tricks-25

DOAG 2011 DP Tricks-26

DOAG 2011 DP Tricks-27

DOAG 2011 DP Tricks-28

DOAG 2011 DP Tricks-29

DOAG 2011 DP Tricks-30

DOAG 2011 DP Tricks-31

DOAG 2011 DP Tricks-32

DOAG 2011 DP Tricks-33

Hinweis: Eine eigene Zertifizierung der Skripten ist relativ aufwendig und würde den Rahmen dieses Vortrags sprengen. Im Internet existieren jedoch viele Beispiele zu diesem Thema. DOAG 2011 DP Tricks-34

DOAG 2011 DP Tricks-35

DOAG 2011 DP Tricks - 36

Alias CMD Alias CMD ac Add-Content gwmi Get-WmiObject asnp Add-PSSnapin iex Invoke-Expression clc Clear-Content ihy Invoke-History cli Clear-Item ii Invoke-Item clp Clear-ItemProperty ipmo Import-Module clv Clear-Variable iwmi Invoke-WmiMethod compare Compare-Object ipal Import-Alias cpi Copy-Item ipcsv Import-Csv cpp Copy-ItemProperty measure Measure-Object cvpa Convert-Path mi Move-Item dbp Disable-PSBreakpoint mp Move-ItemProperty diff Compare-Object nal New-Alias ebp Enable-PSBreakpoint ndr New-PSDrive epal Export-Alias ni New-Item epcsv Export-Csv nv New-Variable fc Format-Custom nmo New-Module fl Format-List oh Out-Host foreach ForEach-Object ogv Out-GridView % ForEach-Object ise powershell_ise.exe ft Format-Table rbp Remove-PSBreakpoint fw Format-Wide rdr Remove-PSDrive gal Get-Alias ri Remove-Item gbp Get-PSBreakpoint rni Rename-Item gc Get-Content rnp Rename-ItemProperty gci Get-ChildItem rp Remove-ItemProperty gcm Get-Command rmo Remove-Module gdr Get-PSDrive rsnp Remove-PSSnapin gcs Get-PSCallStack rv Remove-Variable ghy Get-History rwmi Remove-WmiObject gi Get-Item rvpa Resolve-Path gl Get-Location sal Set-Alias gm Get-Member sasv Start-Service gmo Get-Module sbp Set-PSBreakpoint gp Get-ItemProperty sc Set-Content gps Get-Process select Select-Object group Group-Object si Set-Item gsv Get-Service sl Set-Location gsnp Get-PSSnapin swmi Set-WmiInstance gu Get-Unique sleep Start-Sleep gv Get-Variable sort Sort-Object DOAG 2011 DP Tricks-37

Alias CMD Alias CMD sp Set-ItemProperty set Set-Variable saps Start-Process type Get-Content start Start-Process icm Invoke-Command spps Stop-Process clhy Clear-History spsv Stop-Service gjb Get-Job sv Set-Variable rcjb Receive-Job tee Tee-Object rjb Remove-Job where Where-Object sajb Start-Job? Where-Object spjb Stop-Job write Write-Output wjb Wait-Job cat Get-Content nsn New-PSSession cd Set-Location gsn Get-PSSession clear Clear-Host rsn Remove-PSSession cp Copy-Item ipsn Import-PSSession h Get-History epsn Export-PSSession history Get-History etsn Enter-PSSession kill Stop-Process exsn Exit-PSSession lp Out-Printer ls Get-ChildItem man help mount New-PSDrive md mkdir mv Move-Item popd Pop-Location ps Get-Process pushd Push-Location pwd Get-Location r Invoke-History rm Remove-Item rmdir Remove-Item echo Write-Output cls Clear-Host chdir Set-Location copy Copy-Item del Remove-Item dir Get-ChildItem erase Remove-Item move Move-Item rd Remove-Item ren Rename-Item DOAG 2011 DP Tricks-38