Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
In Exchange 2007 what are the steps\administration tasks performed by GUI will be work internally by running powershell commands. we can copy these command in clipboard.
Windows powershell is default from server 2008.we need install the powershell feature.
In powershell command prompt select Left click for the text to copy.
Enter to copy the command.
Right click to paste in command shell.
cntrl c - to pause the Script Excution.
In powershell there are Four Execution Policys as mentioned below.
set-executionpolicy allsigned
1) It will check the script is signed or not.
2) It will compare the script code with signed code if both are same script will pass otherwise it will through error.
3)It will check the certificate authority (ex:-CA)is trusted or not as per company policies
set-executionpolicy Restricted
Set-executionpolicy unrestricted
set-executionpolicy remotesigned
with out a script path it wont recognize
ex:-./ should be there in the directory path or full path with out quotes
ping localhost gives the name of Machine. In Power shell program files will consider both as separate key words we need to add
"program files" or 'program files' to make it single key word.
cd.. use for go back of single directory.
Power shell has the ability to map storage data to a drive.
EX:-HKLM, environment.
What is psdrive?
It is very useful to create power shell drives with the help of ps dirve we can map registry stuff. Or we can create New PS drives. EX:- For AD we can create PSDrive.
Is used for outfile “ >”---EX:- PS(List of process)>process.txt. It will copy all the process to process.txt file.
to append file >>.—Ex:-PS>>process.txt
type is used to display the content of powershell. help dir help dir –example Help dir –full Help dir -detailed
Dir –filter “*.dll”
-filter is parameter. In PS all the parameter will starts will “-“symbol.
Syntax of perameter:--<perameter> space <value>
Syntax of command Let:-<verb>-<noun>
Ex:-Get-Eventlog
Get-command is used to display all the cmdlets. Get-command *wmi*( Generally command will start with verb ex:- get,set e.t.c so we are
using a *)
Gcm(alias) of get-command which display the of noun in cmd prompt.
c
“-recurse” is used to get the results inside the folder.
Ex:-Dir –path “C:\program files” –recurse “*.dll”
Creating a New-alias d get-childitem. PsSanpins:-It contains a collection of commandlets. It is like a Module EX:-AD. Which we can
add in powershell console in the form of mmc console.
What IF
Is used to check what will happen if a command is excuted.
The following parameter does not exists for all the command lets. If it exists we can use in the below ways
Killing svchost command displays what all process it is going to kill
The results display by powershell command some time are not displayed propertly due screen size of cmd dialog in order to avoid we can use format command.
Some time power shell command will display the default rows provided Microsoft we can see additional details by format-list
*----will help to list all the properties in the command let.
Power shell 2.0 does not support remoting for that reason we need to use WMI.
Get-E +Tab will display the commands starts with E.
F7 –Is used to Open the Buffer commands.
Other Power shell Tools:-PowerGui and Powershell+
Providers:-
These providers are designed to take information out of product and exposed in common information model (CIM).WMI will get the information thru porviders. Each product will have its own provider.
NameSpace:-Generally speaking each name space represent particular product.
Ex:-IIS,SQL e.t.c
Class:-A class is a manageable component.
EX:- Dist space----Manageable components.
1)Free space 2)total size 3)defragmentation.
Instance: - Is a real world occurrence for these classed. For Disk space instance are C and D drives.
CIMV2 is the name space for core OS
Methods:-
This displays the action which we can perform.
Ex:-Start a service ,stop a service for win32_service.
WMI is a case sanative in powershell.
Help gwmi will give sytax of wmi.
Gwmi win32_service –filter “name like ‘b%’”---This command is used to check the name of the service starts with b.
Command to query two computers.
Command to get the information from the text file.
WMI Strings.
---------------------------------Need to add---------------------------------------
Running video: - Time: - completed perfectly:-up to 8