PowerShell Module Browser

Thursday, August 10, 2017

PowerShell Module Browser Microsoft is announcing the release of the PowerShell Module Browser, an easy, predictable way to search all Microsoft PowerShell modules and cmdlets.                
no comments

Installing Windows Server Backup on Windows Server 2012 R2

Thursday, July 27, 2017

Installing Windows Server Backup on Windows Server 2012 R2     Windows Server Backup is not installed by default. You can use the Add Features Wizard in Server Manager to install it. After you use install Windows Server Backup, you can click Windows Server Backup on the Administrative Tools menu to manage backup operations, and you can use Wbadmin.exe to run backup commands from the command line. You must also install the Windows PowerShell feature on the same computer to run Windows Server Backup command-line tools. If the Windows PowerShell feature is not installed when you select Command-line Tools during Windows Server Backup installation, you are prompted to install...
no comments

PowerCLI: Export VM Guest Logs files to Local Computer

Last week I needed to export vmware.log files. In the normal way you can read using putty client or download log using Datastore Browser. But you also can download logs using PowerCLI. to do it, we using cmdlet Copy-DatastoreItem  cmdlet Syntax: Copy-DatastoreItem <Object> <Object>]   To find the location of a virtual machine run this script: get-vm MyVirtualMachine| Get-Datastore |Select name   Connect to Datastore using New-PSDrive cmdlet and change location to VM folder using Set-Location cmdlet. New-PSDrive -Location $datastore -Name ds -PSProvider VimDatastore -Root "\" Set-Location ds:\ cd $vm To display list log files, simple run ls *.log       At this point we can begin copy files from Datastore to local computer: Copy-DatastoreItem -Item *.log -Destination...
no comments

Powershell : Count Members of a AD Group

Tuesday, May 31, 2016

Powershell : Count Members of a AD Group As System Administrator, In many cases you need to count members of AD group. The Get-ADGroupMember cmdlet gets the members of an Active Directory group. Members can be users, groups, and computers. Code: $users = Get-ADGroupMember -Identity 'Group Name' $users.count 132
4 comments

Powershell – Windows Environment variables list

Monday, February 22, 2016

Powershell - Windows Environment variables list Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. Get Environment variables list using Powershell To get a list of variables we use the following command: Get-ChildItem Env | Sort- Name Get-ChildItem ENV | Sort Name and result see like that :   Examples Example 1: System root $Env:Systemroot           Example 2: ALL USERS PROFILE $Env:AllUSERSPROFILE         Example 3: PROCESSOR_ARCHITECTURE $Env:PROCESSOR_ARCHITECTURE
no comments

PowerShell: Unlock Active-Directory Users Account

Monday, November 23, 2015

How to: Unlock Active-Directory Users Account via PowerShell First, open PowerShell in administrator right. Import Module Active-Directory    Run command Search-ADAccount - LockedOut If there are any locked accounts, they will be shown like the following example: To unlock account(s), add Unlock-ADAccount parameter to basic command #Examples Search and unlock all account in domain Search-ADAccount -LockedOut | Unlock-ADAccount Limit the search to a specific OU, Search-ADAccount -SearchBase "OU=Users,OU=Skepper,DC=MyDomain,DC=net" -LockedOut | Unlock-ADAccount Limit search to  Users Only Search-ADAccount -UsersOnly -LockedOut | Unlock-ADAccount  
no comments

Send SMTP Email using PowerShell

Sunday, November 15, 2015

As system administrator in Microsoft environments you may need to send SMTP email via PowerShell. In this article I'll explain how to do this easily by using cmdlet  “Send-MailMessage”. you can read more about this cmdlet here. Please note: This command is supported by PowerShell version 2 or higher. Variables command: $smtp = "smtp server, IP or FQDN" $to = "Mail Recipient" $from = "from email" $subject = "subject" $body = "body email" $Attch = "Attachment file" Send-MailMessage -smtp $smtp -to $to -from $from -subject $subject -body $body -Attachments $Attch Example: $smtp = "SMTP.BB.AA.COM" $to = "ExAdmin@bb.aa.com" $from = "System@bb.aa.com" $subject = "DB Status Report" $body = "Attached DB Status for week 22" $Attch = "C:\DB.log" Send-MailMessage -smtp $smtp -to...
no comments

PowerCLI: Get all Power-off VMs

Sunday, May 4, 2014

How to: Get all Power-off VMs by using PowerCLI. This Guide will guide you how to detect all Power-off VMs (vmware). Some time we put VM in power off mode and never touch them any more, after some month we wave a list of VMs in POwer-off mode,   There's nothing wrong, but if the space shortage begins to form we will have to delete the irrelevant.   We can identify by looking in vSphere client, #Blue icon - Power Off #Green icon - Power On   At Situation we want to get more information, such as disk size of each server, we going to using PowerCLI script: Code: Get-VM | where...
no comments

PowerShell – Get-Uptime

Monday, March 3, 2014

Get Uptime Info via PowerShell Script This script How much time system is up ,Hours, Minutes and Secends So, you need to know how many time your system is up, Here a little PowerShell script that showing this info. Code: $wmi = Get-WmiObject -class Win32_OperatingSystem         $LBTime = $wmi.ConvertToDateTime($wmi.Lastbootuptime)         $uptime = New-TimeSpan $LBTime $(get-date)         Write-Output "$($uptime.days) Days $($uptime.hours) Hours $($uptime.minutes) Minutes $($uptime.seconds) Seconds" simple and effective :-) Skepper
no comments