Archive for the ‘PowerShell’ Category

Power shell

Key Meaning (Alt)+(F7) Deletes the current command history (PgUp), (PgDn) Display the first (PgUp) or last (PgDn) command you used in current session (Enter) Send the entered lines to PowerShell for execution (End) Moves the editing cursor to the end of the command line (Del) Deletes the character to the right of the insertion point (Esc) […]

More »

PowerShell Search For list Of Users

Power-Shell Is a very handy tool for administrators. We meet again with this post to demonstrates hoe to get users info from active directory for list of users stored in CSV File First we will make Text File with Search Criteria separated by comma email, email1@contoso.com, email2@contoso.com, email3@contoso.com, email4@contoso.com, email5@contoso.com, Save it in CSV File […]

More »

Simple PowerShell Script To Retrieve Data From DataBase

As im continuing posts on PowerShell scripts . This post to demonistrate how to connect to sqlserver and retrieve data from DataBase. $connString = "data source=.;Initial catalog=Production;uid=sa;pwd=uer_password;" $QueryText = "select * from TableName" $SqlConnection = new-object System.Data.SqlClient.SqlConnection $SqlConnection.ConnectionString = $connString $SqlCommand = $SqlConnection.CreateCommand() $SqlCommand.CommandText = $QueryText $DataAdapter = new-object System.Data.SqlClient.SqlDataAdapter $SqlCommand $dataset = new-object System.Data.Dataset […]

More »

Powershell rename all files in a folder

Avery hard question to ask How to rename all files in folder ? And the answer is very simple use Powershell I will make a simple code to get all files in the folder and search for word or pattern in the name And change the name of the file . $Files = get-childitem -path […]

More »

Replacing Strings in Multiple Files in Folder and SubFolders

This is the second article on windows PowerShell scripting . Now what we want to do ? Simply we want to replace certain string by another string value in all files in certain folder and All sub folders . $items = Get-ChildItem * -recurse # enumerate the items array foreach ($item in $items) {   […]

More »

PowerShell get list of all files by size or name

I having fun Playing with Windows PowerShell This Post will demonstrate how cool it’s and this will be the beginning of new seriaes talking about PowerShell. let’s go ahead if you has folder contains files and you want to get a list of all files in this folder and sub folder by size?! this is […]

More »