Home » Archive by category "Powershell"

Finding Inactive or Unused Computers

dsquery user -startnode forestroot -samid <username> | dsmod user -pwd <new_password> DsQuery | HomeWorks’s Blog (wordpress.com) Share This:

Backup GPOs basing on GPO DisplayName

$invalidChars = ‘:\\/’ + [RegEx]::Escape(-join [IO.Path]::InvalidPathChars) $backupDir = ‘C:\temp\backup’ Get-GPO -All -Domain <DOmain Name>| ForEach-Object { $name = $_.DisplayName -replace “[$invalidChars]”, ‘_’ $gpoDir = Join-Path...

Function Name: Get-LoggedIn

Function Name: Get-LoggedIn   # ——————————————- # Function Name: Get-LoggedIn # Return the current logged-in user of a remote machine. # ——————————————- function Get-LoggedIn {...

Function Name: Get-Uptime

Function Name: Get-Uptime # ——————————————- # Function Name: Get-Uptime # Calculate and display system uptime on a local machine or remote machine. # ——————————————- function...

VM inventory using Powershell

Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope User -Confirm:$false Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope User -Confirm:$false #$cred = Get-Credential Domain\username Connect-VIServer VCenter-Name -Credential $cred -force & { foreach ($vCenterServer...

Add Notes To Multiple VM’s

Note: This script will overwrite the existing Notes, so use it at your own risk! My colleague asked me to add some notes to the...

NewRemote-Process

cls Function New-RemoteProcess { #[CmdletBinding()] Param( [String]$ComputerName = $env.computername, [String]$Cmd = $(Throw “You must enter path to the command which will create the process”), [String]$ac,...

Moving Object from one OU to other OU

Get-Content C:\temp\Computers.txt| %{Move-ADObject -Identity “CN=$_,OU=WIN10,OU=ABC,OU=Computers,DC=CHILD,DC=Domain,DC=Vmwareenterprise,DC=com” -TargetPath “OU=Prod,OU=WIN10,OU=ABC,OU=Computers,DC=dev,DC=DIR,DC=vmwareenterprise,DC=com”} -Verbose Share This: