четверг, 31 декабря 2020 г.

Useful Windows shortcuts for sysadmins

appwiz.cpl - Add/Remove programs

ncpa.cpl - Network Cards

Control - Control Panel

Netplwiz - local user accounts

LUSRMGR.MSC - local user and group accounts (as in Compmgmt.msc)

Define permissions with SubInAcl (PowerShell script with Menu)

   cls

   # SubInACL #

#==PARAMETERS==

$Tool1="subinacl"

$UpDirOwner="MyDomain\Domain Admins"

$SubDirOwner="MyDomain\Domain Admins"

$UpDirUser="MyDomain\User"

$SubDirUser="MyDomain\User"

$UpDir="\\X.X.X.X\PSTs\" # use with /file parameter

$SubDir=-join($UpDir+"\*") # use with /subdirectories parameter

$errorlog="C:\temp\errorlog.txt"

$outputlog="C:\temp\outputlog.txt"

# ==OPTIONAL PARAMETERS==

# MD $UpDir # If you want to create UpDir you need to remove # sign from the beginnig of this line...

# ==OWNERSHIP==

& $Tool1 /errorlog=$errorlog /outputlog=$outputlog /file $UpDir /setowner=$UpDirOwner

ii $errorlog

& $Tool1 /errorlog=$errorlog /outputlog=$outputlog /subdirectories $SubDir /setowner=$SubDirOwner

ii $errorlog

#==PERMISSIONS==#

   $FullControl = "F"

   $Change = "C"

   $ReadeXecute = "E"

#============#============#

DO

{

$menu=@"

1. Full Control $FullControl; 

2. Change/Modify $Change; 

3. Read eXecute $ReadeXecute; 

Select a Permission by its number

"@

#============#============#

#Clear-Host

Write-Host ""

Write-Host "=Permission Menu=" -ForegroundColor Green

Write-Host ""

$Selection = Read-Host $Menu

#============#============#

$a = "N"

Switch ($Selection) { #Begin Switch

"1"{

    $FullControl

    & $Tool1 /file $UpDir /grant=$UpDirUser=$FullControl

    & $Tool1 /subdirectories $SubDir /grant=$SubDirUser=$FullControl

    Write-Host User $UpDirUser granted FullControl permissions on $UpDir folder and its subfolders

    $a = "Y"

    }

"2" {

    $Change

    & $Tool1 /file $UpDir /revoke=$UpDirUser

    & $Tool1 /file $UpDir /grant=$UpDirUser=$Change

    & $Tool1 /subdirectories $SubDir /revoke=$SubDirUser

    & $Tool1 /subdirectories $SubDir /grant=$SubDirUser=$Change

    Write-Host User $UpDirUser granted Change/Modify permissions on $UpDir folder and its subfolders

    $a = "Y"

    }

"3" {

    $ReadeXecute

    & $Tool1 /file $UpDir /revoke=$UpDirUser

    & $Tool1/file $UpDir /grant=$UpDirUser=$ReadeXecute

    & $Tool1 /subdirectories $SubDir /revoke=$SubDirUser

    & $Tool1 /subdirectories $SubDir /grant=$SubDirUser=$ReadeXecute

    Write-Host User $UpDirUser granted ReadeXecute permissions on $UpDir folder and its subfolders

    $a = "Y"

    }

    default {

    Write-Host "I don't understand what do you want to do." -ForegroundColor Yellow

}

} #end switch

}

UNTIL ($a -eq "Y")

# CHECK PERMISSIONS

& $Tool1 /file $UpDir

& $Tool1 /subdirectories $SubDir

ii $UpDir


Using SubInAcl with PowerShell script

# subinacl #

$Tool1="subinacl"


$Permission=""

$UpDirOwner="Domain\Domain Admins"

$SubDirOwner="Domain\Domain Admins"

$UpDirUser="Domain\User"

$SubDirUser="Domain\User"

$UpDir="\\X.X.X.X\Folder" # use with /file parameter

$errorlog="C:\temp\errorlog.txt"

$outputlog="C:\temp\outputlog.txt"


# Optional parameters

# MD $UpDir # If you want to create UpDir you need to remove # sign from the beginnig of this line...

$SubDir=-join($UpDir+"\*") # use with /subdirectories parameter


& $Tool1 /errorlog=$errorlog /outputlog=$outputlog /file $UpDir /setowner=$UpDirOwner

ii $errorlog

ii $outputlog

& $Tool1 /errorlog=$errorlog /outputlog=$outputlog /subdirectories $SubDir /setowner=$SubDirOwner

ii $errorlog

ii $outputlog

& $Tool1 /errorlog=$errorlog /outputlog=$outputlog /file $UpDir /grant=$UpDirUser=C

ii $errorlog

ii $outputlog

& $Tool1 /errorlog=$errorlog /outputlog=$outputlog /subdirectories $SubDir /grant=$SubDirUser=C

ii $errorlog

ii $outputlog


ii $UpDir


  

Search VMWare VMs and put to CSV - PowerShell

cls

## This script is prepared by Dr.Vlad

# The script searches for VMs by 3 parameters: VM name, Hostname, IP address

# The script outputs the found data in CSV file format, it is usable by itself or as basis for another script which uses it for fast searchin and making actions on found VM

# The script makes use of saved credentials ##


$vCs = 'vcsa-65', 'vcenter-5-5','vcenter-6-014'

$FileName = "V:\SCRIPTS\Scheduled\VM_REPORT.csv"

$FileNameDate = "V:\SCRIPTS\Scheduled\OldDates\VM_REPORT_$(get-date -f yyyy-MM-dd).csv"

$Title = "VMs_REPORT"

Disconnect-VIServer * -Confirm:$false


$PATH = ""

$VC = ""

$VC1 = ""

$VC2 = ""

$VC3 = ""

$User = ""

$Pass = ""

$Report = ""

$VMachines = ""

$Excel_Array =  ""

$VMachines = ""

$VMName = ""

$DNSHostname = ""

$OS = ""

$Nics = ""

$IPAddress = ""

$IP = ""

$VMHost = ""

$CPU = ""

$Memory = ""

$Count = ""

$VM = ""

$VMPowerstate = ""

$VC_IP = ""


$Credentials = Import-Clixml "C:\cred\Credentials_Metropolinet.xml"

$User = $Credentials.UserName

$Pass = $Credentials.GetNetworkCredential().Password


$Excel_Array = New-Object System.Collections.ArrayList


FOREACH ($vC IN $vCs)

{

 

 Connect-VIServer -User $User -Password $Pass $VC


 $Count = (GET-VM | measure).count


 IF($vC -eq "vcsa-65"){$VC_IP = "172.30.1.1"}

 IF($vC -eq "vcenter-5-5"){$VC_IP = "172.30.10.151"}

 IF($vC -eq "vcenter-6-014"){$VC_IP = "172.30.100.146"}


 Write-Host $vC $VC_IP contain $Count VMs! -ForegroundColor GREEN


 $VMachines = Get-View -ViewType Virtualmachine

 


 FOREACH ($VMs IN $VMachines)

 {

    $VMName = $VMs.Name

    $DNSHostname = $VMs.guest.hostname

    $OS = $VMs.Config.GuestFullName

    #$vCenter = ([uri]$VMs.Client.ServiceUrl).Host

    $VMPowerstate = $VMs.RunTime.PowerState

    $Nics = $VMs.summary.config.numEthernetCards

    $IP = $VMs.Guest.Net.ipconfig.ipaddress.ipaddress -join '  '

    $VMHost = (Get-View -Id $VMs.Runtime.Host -Property Name).Name

    $CPU = $VMs.Config.Hardware.numCPU

    $Memory = $VMs.Config.Hardware.memoryMB


    $VMInfo = New-Object -Type PSObject

            $VMInfo | Add-Member -MemberType NoteProperty -Name "VMName" -Value "$VMName" -Force

            $VMInfo | Add-Member -MemberType NoteProperty -Name "DNSHostName" -Value "$DNSHostName" -Force

            $VMInfo | Add-Member -MemberType NoteProperty -Name "VM_State" -Value "$VMPowerstate" -Force

            $VMInfo | Add-Member -MemberType NoteProperty -Name "VM_OS" -Value "$OS" -Force

            $VMInfo | Add-Member -MemberType NoteProperty -Name "vC_NAME" -Value "$VC" -Force

            $VMInfo | Add-Member -MemberType NoteProperty -Name "vC_IP" -Value "$VC_IP" -Force

            $VMInfo | Add-Member -MemberType NoteProperty -Name "VM_IP" -Value "$IP" -Force

                                    

            # $VMInfo | Add-Member -MemberType NoteProperty -Name "VMHost" -Value "$VMHost" -Force

            # $VMinfo | Add-Member -MemberType NoteProperty -Name "Nics" -Value "$Nics" -Force

            # $VMInfo | Add-Member -MemberType NoteProperty -Name "CPU" -Value "$CPU" -Force

            # $VMInfo | Add-Member -MemberType NoteProperty -Name "Memory" -Value "$Memory" -Force

            

            $Excel_Array.Add($VMinfo) | Out-Null


    $VMName = ""

    $DNSHostname = ""

    $OS = ""

    $Nics = ""

    $IPAddress = ""

    $IP = ""

    $VMHost = ""

    $CPU = ""

    $Memory = ""

    $VM = ""

    $VMPowerstate = ""

 }

    Disconnect-VIServer * -Confirm:$false

    $VC_IP = ""

    $VMachines = ""

}


# CD "$CurrentDir"

# $Excel_Array | Out-GridView -Title $Title

$Excel_Array | Export-CSV -path $FileName -NoTypeInformation

$Excel_Array | Export-CSV -path $FileNameDate -NoTypeInformation

$FileNameDate

# ii $FileName

 

Change font in PowerShell ISE (script)

 

$psISE.Options.FontName = 'Lucida Sans Console' 

$psISE.Options.FontSize = 12

Use PowerShell with GUI menu to search for VMware VM in a CSV file and perform an action

<# This script utilizes the "AnyBox" GUI menu and saved credentials to search for a VM/computer/IP by hostname, VM name, or IP. The script retrieves data from a pre-prepared CSV file (the script for CSV preparation is also available on this site). Some parameters in the script will need to be changed to match the environment being used. #>

Clear-Host

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
$ErrorActionPreference= 'SilentlyContinue'
Add-PsSnapin VMware.VimAutomation.Core
Disconnect-VIServer * -Confirm:$false
$CSVName = "V:\SCRIPTS\Scheduled\VM_REPORT.csv" # Change this parameter

#============ZEROING$PARAMETERS============#

$vC_NAME = ""
$DataObj = ""
$VMName = ""
$VMName1 = ""
$VMName2 = ""
$VMName3 = ""
$VMName4 = ""
$VMName5 = ""
$VMName6 = ""
$VM_IP = ""
$VM_IP1 = ""
$VM_IP2 = ""
$VM_IP3 = ""
$VM_IP4 = ""
$VM_IP5 = ""
$VM_IP6 = ""
$vC = ""
$vC_NAME = ""
$vC_NAME1 = ""
$vC_NAME2 = ""
$vC_NAME3 = ""
$vC_NAME4 = ""
$vC_NAME5 = ""
$vC_NAME6 = ""
$vC_IP1 = ""
$vC_IP2 = ""
$vC_IP3 = ""
$vC_IP4 = ""
$vC_IP5 = ""
$vC_IP6 = ""
$DNSHostName = ""
$DNSHostName1 = ""
$DNSHostName2 = ""
$DNSHostName3 = ""
$DNSHostName4 = ""
$DNSHostName5 = ""
$DNSHostName6 = ""
$VM_State1 = ""
$VM_State2 = ""
$VM_State3 = ""
$VM_State4 = ""
$VM_State5 = ""
$VM_State6 = ""

#============CREDENTIALS============#

$User = "User@MyDomain.local" # Change this parameter
$Credential = Import-Clixml "C:\cred\Credentials_MyDomain.xml" # Change this parameter
$User = $Credential.UserName
$Pass = $Credential.GetNetworkCredential().Password

# $Name = Read-Host "Put a Name" #
# Write-Host = Enter VM/Host/IP for searching =

# GUI input box
[Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') > $NULL
$Name = [Microsoft.VisualBasic.Interaction]::InputBox('Enter VM/Host/IP for searching', 'VM Search Box')
Write-Host The Name you entered is "'$Name'"
$VMName = -join ($Name,"*")
$DNSHostName = -join ($Name,"*")
$VM_IP = $Name 

$DataObj = Import-Csv $CSVName | Where-Object {($_."VMName" -like $VMName) -or ($_."DNSHostName" -like $DNSHostName) -or ($_."VM_IP" -like $VM_IP)} | Select VMName, DNSHostName, VM_IP, VM_State, VC_NAME, VC_IP

$DataObj | FT
$NUM = $DataObj.Count
Write-Host Count = $NUM
# $DataObj | Out-GridView -Title $Name

#============PARAMETERS============#

$VMName1 = $DataObj[0].VMName
$VMName2 = $DataObj[1].VMName
$VMName3 = $DataObj[2].VMName
$VMName4 = $DataObj[3].VMName
$VMName5 = $DataObj[4].VMName
$VMName6 = $DataObj[5].VMName
$VM_IP1 = $DataObj[0].VM_IP
$VM_IP2 = $DataObj[1].VM_IP
$VM_IP3 = $DataObj[2].VM_IP
$VM_IP4 = $DataObj[3].VM_IP
$VM_IP5 = $DataObj[4].VM_IP
$VM_IP6 = $DataObj[5].VM_IP
$vC_NAME1 = $DataObj[0].vC_NAME
$vC_NAME2 = $DataObj[1].vC_NAME
$vC_NAME3 = $DataObj[2].vC_NAME
$vC_NAME4 = $DataObj[3].vC_NAME
$vC_NAME5 = $DataObj[4].vC_NAME
$vC_NAME6 = $DataObj[5].vC_NAME
$vC_IP1 = $DataObj[0].vC_IP
$vC_IP2 = $DataObj[1].vC_IP
$vC_IP3 = $DataObj[2].vC_IP
$vC_IP4 = $DataObj[3].vC_IP
$vC_IP5 = $DataObj[4].vC_IP
$vC_IP6 = $DataObj[5].vC_IP
$DNSHostName1 = $DataObj[0].DNSHostName
$DNSHostName2 = $DataObj[1].DNSHostName
$DNSHostName3 = $DataObj[2].DNSHostName
$DNSHostName4 = $DataObj[3].DNSHostName
$DNSHostName5 = $DataObj[4].DNSHostName
$DNSHostName6 = $DataObj[5].DNSHostName
$VM_State1 = $DataObj[0].VM_State
$VM_State2 = $DataObj[1].VM_State
$VM_State3 = $DataObj[2].VM_State
$VM_State4 = $DataObj[3].VM_State
$VM_State5 = $DataObj[4].VM_State
$VM_State6 = $DataObj[5].VM_State

    $VMName_INFO = ""
    $VM_IP_INFO = ""
    $vC_NAME_INFO = ""
    $vC_IP_INFO = ""
    $DNSHostName_INFO = ""
    $VM_State_Info = ""
#============MENU============#

DO
{
$menu=@"

1. $VMName1;  $DNSHostName1; $VM_IP1; $VM_State1
2. $VMName2;  $DNSHostName2; $VM_IP2; $VM_State2
3. $VMName3;  $DNSHostName3; $VM_IP3; $VM_State3
4. $VMName4;  $DNSHostName4; $VM_IP4; $VM_State4
5. $VMName5;  $DNSHostName5; $VM_IP5; $VM_State5
6. $VMName6;  $DNSHostName6; $VM_IP6; $VM_State6

Select a VM Name by it's number
"@
#============#============#

#Clear-Host
Write-Host ""
Write-Host "=VM Menu=" -ForegroundColor Cyan
Write-Host ""
$Selection = Read-Host $Menu
#============#============#

$a = "N"
Switch ($Selection) { #Begin Switch
"1"{
    $VMName_INFO = $VMName1
    $VM_IP_INFO = $VM_IP1
    $vC_NAME_INFO = $vC_NAME1
    $vC_IP_INFO = $vC_IP1
    $DNSHostName_INFO = $DNSHostName1
    $VM_State_Info = $VM_State1

    Connect-VIServer -User $User -Password $Pass $VC_IP_INFO
    Write-Host VM "'$VMName_INFO'" consists in vC "'$vC_NAME_INFO'" "'$VC_IP_INFO'"
    Write-Host DNSHostName = "'$DNSHostName_INFO'" and IP = "'$VM_IP_INFO'" and Status = "'$VM_State_Info'"

    $a = "Y"
    }

"2" {
    $VMName_INFO = $VMName2
    $VM_IP_INFO = $VM_IP2
    $vC_NAME_INFO = $vC_NAME2
    $vC_IP_INFO = $vC_IP2
    $DNSHostName_INFO = $DNSHostName2
    $VM_State_Info = $VM_State2

    Connect-VIServer -User $User -Password $Pass $VC_IP_INFO
    Write-Host VM "'$VMName_INFO'" consists in vC "'$vC_NAME_INFO'" "'$VC_IP_INFO'"
    Write-Host DNSHostName = "'$DNSHostName_INFO'" and IP = "'$VM_IP_INFO'" and Status = "'$VM_State_Info'"

    $a = "Y"
    }

"3" {
    $VMName_INFO = $VMName3
    $VM_IP_INFO = $VM_IP3
    $vC_NAME_INFO = $vC_NAME3
    $vC_IP_INFO = $vC_IP3
    $DNSHostName_INFO = $DNSHostName3
    $VM_State_Info = $VM_State3
    Connect-VIServer -User $User -Password $Pass $VC_IP_INFO
    Write-Host VM "'$VMName_INFO'" consists in vC "'$vC_NAME_INFO'" "'$VC_IP_INFO'"
    Write-Host DNSHostName = "'$DNSHostName_INFO'" and IP = "'$VM_IP_INFO'" and Status = "'$VM_State_Info'"

    $a = "Y"
    }

"4" {
    $VMName_INFO = $VMName4
    $VM_IP_INFO = $VM_IP4
    $vC_NAME_INFO = $vC_NAME4
    $vC_IP_INFO = $vC_IP4
    $DNSHostName_INFO = $DNSHostName4
    $VM_State_Info = $VM_State4

    Connect-VIServer -User $User -Password $Pass $VC_IP_INFO
    Write-Host VM "'$VMName_INFO'" consists in vC "'$vC_NAME_INFO'" "'$VC_IP_INFO'"
    Write-Host DNSHostName = "'$DNSHostName_INFO'" and IP = "'$VM_IP_INFO'" and Status = "'$VM_State_Info'"

    $a = "Y"
    }

"5" {
    $VMName_INFO = $VMName5
    $VM_IP_INFO = $VM_IP5
    $vC_NAME_INFO = $vC_NAME5
    $vC_IP_INFO = $vC_IP5
    $DNSHostName_INFO = $DNSHostName5
    $VM_State_Info = $VM_State5

    Connect-VIServer -User $User -Password $Pass $VC_IP_INFO
    Write-Host VM "'$VMName_INFO'" consists in vC "'$vC_NAME_INFO'" "'$VC_IP_INFO'"
    Write-Host DNSHostName = "'$DNSHostName_INFO'" and IP = "'$VM_IP_INFO'" and Status = "'$VM_State_Info'"

    $a = "Y"
    }

"6" {
    $VMName_INFO = $VMName6
    $VM_IP_INFO = $VM_IP6
    $vC_NAME_INFO = $vC_NAME6
    $vC_IP_INFO = $vC_IP6
    $DNSHostName_INFO = $DNSHostName6
    $VM_State_Info = $VM_State6

    Connect-VIServer -User $User -Password $Pass $VC_IP_INFO
    Write-Host VM "'$VMName_INFO'" consists in vC "'$vC_NAME_INFO'" "'$VC_IP_INFO'"
    Write-Host DNSHostName = "'$DNSHostName_INFO'" and IP = "'$VM_IP_INFO'" and Status = "'$VM_State_Info'"

    $a = "Y"
    }

default {
    Write-Host "I don't understand what do you want to do." -ForegroundColor Yellow
}
} #End of switch
}
UNTIL ($a -eq "Y")
#============#============#

            # This part of code is using "AnyBox" feature

  # $Open_Console = Get-VM $VMNAME | Open-VMConsoleWindow
  $Prompt = New-AnyBoxPrompt `
  -Name 'Action' -InputType Text `
  -Message ''$VMNAME_INFO' ; Choose an action' `
  -DefaultValue 'Open-Console' `
  -ValidateSet @('Open-Console', 'Open-RDP', 'Restart_Promptly', 'Hard_Reset', 'Shutdown_Promptly', 'Start-VM', 'Extend_C:', 'Other') ` 

$q = Show-AnyBox -Icon 'Question' -Prompt $prompt -Buttons 'OK'
$OK = $q.OK
$Action = $q.Action

If(($OK -eq $True) -and ($Action -eq "Open-Console")){ Get-VM $VMNAME_INFO | Open-VMConsoleWindow }
If(($OK -eq $True) -and ($Action -eq "Open-RDP")){ mstsc /v:"$DNSHostName_INFO":3389 }
If(($OK -eq $True) -and ($Action -eq "Restart_Promptly")){ Get-VM $VMNAME_INFO | Open-VMConsoleWindow ; Get-VM $VMNAME_INFO | Restart-VMGuest }
If(($OK -eq $True) -and ($Action -eq "Hard_Reset")){ Get-VM $VMNAME_INFO | Open-VMConsoleWindow ; Get-VM $VMNAME_INFO | Restart-VM }
If(($OK -eq $True) -and ($Action -eq "Shutdown_Promptly")){ Get-VM $VMNAME_INFO | Open-VMConsoleWindow ; Get-VM $VMNAME_INFO | Shutdown-VMGuest}
If(($OK -eq $True) -and ($Action -eq "Start-VM")){ Get-VM $VMNAME_INFO | Open-VMConsoleWindow ; Get-VM $VMNAME_INFO | Start-VM }

Write-Host ""
Disconnect-VIServer * -Confirm:$false

<#
Additional tasks to do:
Add opening Excel-CSV;
Rename VM;
Create snapshots: Get-VM | Get-Snapshot 
Delete snapshot: Get-VM | Get-Snapshot | Remove Snapshot
Move-VM to another Datastore;
Move Disk to another VM;
Extend disks space (the most difficult is to identify match between VMDK number and Windows guest disk letter because there is no full proof solution).
#>

среда, 30 декабря 2020 г.

Using SubInAcl with CMD

 File:

  F : Full Control

  C : Change

  R : Read

  P : Change Permissions

  O : Take Ownership

  X : eXecute

  E : Read eXecute

  W : Write

  D : Delete

CD C:\Program Files (x86)\Windows Resource Kits\Tools\

subinacl /errorlog="c:\temp\errorlog.txt" /outputlog="c:\temp\outputlog.txt" /file "\\Server\Share" /setowner=Domain\User

subinacl /errorlog="c:\temp\errorlog.txt" /outputlog="c:\temp\outputlog.txt" /file "\\Server\Share" /grant=Domain\User=C

subinacl /errorlog="c:\temp\errorlog.txt" /outputlog="c:\temp\outputlog.txt" /subdirectories \\Server\Share\* /grant=Domain\User=C

subinacl /help /grant

subinacl /verbose=1 /file c:\temp /display

subinacl /file c:\temp /grant==Domain\User=C

subinacl /file c:\temp /deny==Domain\User=W

subinacl /subdirectories c:\temp\* /grant=Domain\User=C

subinacl /file * /replace=Domain\User1=Domain\User2

subinacl /subdirectories c:\temp\* /revoke=Domain\User

subinacl /subdirectories c:\temp\* /cleandeletedsidsfrom=Domain

subinacl /testmode /subdirectories c:\temp\* /grant=Domain\User=F

subinacl /errorlog="c:\temp\errorlog.txt" /outputlog="c:\temp\outputlog.txt" /subdirectories c:\temp\* /grant=Domain\User=C



среда, 23 декабря 2020 г.

WSUS connection error: Reset Server Node

WSUS GUI console could give sometimes connection error. 

It could be because of stopped Application Pool in IIS.












You can create batch file that will cure the situation by starting Application Poll and WSUS console.

You may change the batch in accordance to your environment.

With this line you can check where the MMC folder is resides.
%AppData%\Microsot\MMC

==Start of Batch==

IISRESET
Timeout /T 5

C:
::
CD C:\Users\vlad\AppData\Roaming\Microsoft\MMC
del wsus

CD C:\Windows\System32\inetsrv
appcmd start apppool wsuspool

CD C:\Program Files\Update Services\AdministrationSnapin\
start /B wsus.msc

==End of Batch==

Run the batch as a administrator.











But it is better to solve the problem for ever then temporarily remediate it.

Change the IIS Application Pool definitions in accordance with the next pictures.















That's all!


четверг, 27 августа 2020 г.

Two Programs For Copying files

TeraCopy - convenient for everyday use.|
It's not super fast, nor have advanced features, as copying file/folder permissions (ACL) 
or copying locked files, or even solving long path/file named problem, but nice for casual use without special demands.

FastCopy - very good program because it's fast on local drives and have possibility for copying ACL (which we not meet frequently)


Copying files with ROBOCOPY batch file

 :=ROBOCOPY=
@ECHO OFF
MD c:\Robolog
Robocopy /S /r:1 /J /Z /XO /np /COPY:DT /W:1 /tee /V /LOG+:c:\Robolog\robolog.txt /ETA E:\ P:\



понедельник, 15 июня 2020 г.

An easy way to run Computer Management remotely

To use Computer Management with a remote computer, you can run the following command in CMD or the Run window:

compmgmt.msc /computer=ComputerName

Alternatively, create a batch file named "cm.bat" with the following line only: start /B compmgmt /Computer=%1

From now on, you can use the simple command "cm ComputerName" in CMD or the Run window to access Computer Management.

If you need to run multiple instances of Computer Management with different computers, create a batch file with the following lines: compmgmt.msc /computer=Computer1 compmgmt.msc /computer=Computer2 compmgmt.msc /computer=Computer3

To use different domains with different credentials, you can use the cmdkey command before running the batch file: cmdkey /add:Computer1 /user:Domain1\user1 /pass:Password1 cmdkey /add:Computer2 /user:Domain2\user2 /pass:Password2

Alternatively, you can use the net use command to set credentials: net use \computername\ipc$ Password /user:ComputerName\user1 net use \computername\ipc$ Password /user:DomainName\user1


понедельник, 8 июня 2020 г.

How To Uninstall Updates with CMD

1. Go to CMD.

2. Find all updates with this command:
wmic qfe list brief /format:table

3. Using HotFixID from previous step uninstall it:
wusa /uninstall /kb:HotFixID

For example:
wusa /uninstall /kb:4539601

воскресенье, 31 мая 2020 г.

How to delete stubborn item in Outlook

If you are unable to delete an item in Outlook, try the following steps:

суббота, 30 мая 2020 г.

How to Enable RDP remotely with psexec

Here are the steps to enable remote access to a computer:

  1. Download the Psexec command line tool from: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

  2. Use Psexec to enter the computer you want to access remotely: psexec \\CompName CMD

  3. Check the firewall status. If desired, disable the firewall with the following command: netsh advfirewall set currentprofile state off

  4. Enable remote desktop protocol (RDP) by adding a registry value: reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f

  5. Remote access to the computer is now enabled.


четверг, 21 мая 2020 г.

Windows update errors

If you want to update your Windows computer and are experiencing errors, there are ways to overcome the obstacles.

Error 80072EE2 / 80072eFD
check connectivity to WSUS by port 8530 or connectivity to Microsoft update site.
In addition, if you are using BatchPatch, error 102 also witnesses about lack of connectivity.

Error 80070070
free up disk space.

Error 80092004
If you want to receive future security patches 
install kb4474419 from:
https://www.catalog.update.microsoft.com/Search.aspx?q=kb4474419
or
install kb4490628 from:
https://www.catalog.update.microsoft.com/search.aspx?q=kb4490628

Here is the explanation:
https://windowsreport.com/kb4474419-kb4490628-kb4484071/

Direct download links
We're adding the /quiet /norestart switches to prevent the operating system from restarting your computer after installing the update

Error 80080005
To work around this problem you need to modify registry:

Locate the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems

By default, the Windows entry in the subkey has a value that is similar to the following:
%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

Locate SharedSection and add 512 to SharedSection.

The newly changed Windows entry reads as follows:
%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

Error 8024000E
Install update KB947821