Tuesday, April 24, 2018

Powershell-Command to Copy data from one location to another

Command to Copy data from one location to another

Copy-Item \\server11\c$\temp\test.exe -Destination \\server12\c$\ -ErrorAction silentlycontinue




Regards
Bijesh

Command to get "Password last set,Last logon " Dates for a local User account

Command to get "Password last set,Last logon " Dates for a local User account

For Local System Account,

Net user <Username>

For Domain User Account ,

Net User <Username>  /Domain




Regards
Bijesh

Sunday, April 22, 2018

Command to list all drivers details in a system

Driver query is a simple Command to list all drivers details in a system.



Regards
Bijesh

Wednesday, April 18, 2018

Command to enable-ping-response-on-windows

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

Regards
Bijesh

Powershell -To get List of Windows servers from Active Directory

Get-ADComputer -Filter { OperatingSystem -Like '*Windows Server*' } -Properties OperatingSystem | Select Name,OperatingSystem 


Regards
Bijesh

Vmware launched VMware vSphere 6.7

https://blogs.vmware.com/vsphere/2018/04/introducing-vmware-vsphere-6-7.html

Regards
Bijesh

Monday, March 26, 2018

Horizon view | Powercli command to get the number of VM's in all pool

This  is a Horizon view  Powercli command to get the number of VM's in all available pool with status connected/disconnected.


Get-Pool | %{
   $remote = Get-RemoteSession -Pool_id $_.Pool_id
   $_ | Select @{N="Name";E={$_.Pool_id}},
     @{N="VM in pool";E={Get-DesktopVM -Pool_id $_.Pool_id | Measure-Object | Select -ExpandProperty Count}},
     @{N="Connected";E={$remote | where {$_.State -eq "CONNECTED"} | Measure-Object | Select -ExpandProperty Count}},
     @{N="Disconnected";E={$remote | where {$_.State -eq "DISCONNECTED"} | Measure-Object | Select -ExpandProperty Count}}
 }



Regards
Bijesh

Sunday, March 25, 2018

Power shell Script to get Server reboot history

Being an Admin we may wanted to get server reboot history.We can get it through event viewer and look for event 1024.But how to filter only the reboot events.This powershell script helps to filter logs from remote system and get the desired output


Get-WinEvent -cn <Computer> -FilterHashtable @{logname='System'; id=1074}  | ForEach-Object {
$ev = New-Object PSObject | Select-Object Date, User, Action, Process, Reason, ReasonCode, Comment
$ev.Date = $_.TimeCreated
$ev.User = $_.Properties[6].Value
$ev.Process = $_.Properties[0].Value
$ev.Action = $_.Properties[4].Value
$ev.Reason = $_.Properties[2].Value
$ev.ReasonCode = $_.Properties[3].Value
$ev.Comment = $_.Properties[5].Value
$ev
} | Select-Object Date, Action, Reason, User





Regards
Bijesh

vSphere 6.5 topology and upgrade Planning Tool

Vmware tool for vSphere 6.5 topology  and upgrade Planning

https://vspherecentral.vmware.com/path-finder/




Regards
Bijesh

Saturday, March 24, 2018

Horizon view | Powercli command to get the Connected user’s list


Get-RemoteSession -State Connected |Select DNSName,Username

Regards
Bijesh

Horizon view | Powercli command to get the list of unassigned VM's


With View powercli command we can pull the list of unassigned vm's .Below is  the onliner to save the list of unassigned vm list  to C drive


Get-Pool | Select Pool_id, @{Name="Unassigned VMs";Expression={($_ | Get-DesktopVM | ? {$_.user_displayname -eq "$null"})} |Out-File c:\VMlist.txt





Regards
Bijesh

Horizon view | Powercli command to get the number of unassigned VM's



Get-Pool | Select Pool_id, @{Name="Unassigned VMs";Expression={($_ | Get-DesktopVM | ? {$_.user_displayname -eq "$null"}).Count}}


Regards
Bijesh

PowerCli -To get average cluster resources usage Report

This is a simple command to get the report  on vcenter cluster Resource usage for last 3 Days


Get-Cluster| Select Name, `
@{N="CPU Usage (Average), Mhz" ; E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}}, `
@{N="Memory Usage (Average), %" ; E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , `
@{N="Network Usage (Average), KBps" ; E={[Math]::Round((($_ | Get-Stat -Stat net.usage.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , `
@{N="Disk Usage (Average), KBps" ; E={[Math]::Round((($_ | Get-Stat -Stat disk.usage.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} |ft



Regards
Bijesh

Power Shell Command To Get Print Queue

To Get Print Queue from a remote print server


Get-WMIObject Win32_Printer -ComputerName <PrintServerName> |Format-Table -AutoSize


Regards
Bijesh