четверг, 5 декабря 2019 г.

GPO Power Options

Configuring Power Options Using Domain Policies

Policies


Computer Configuration -> Administrative Templates -> System -> Power Management
[edit_power_plan_policy[4].png]

Preferences

Using group policies to manage the power profiles on Windows systems is a feature that has been missing and desired for many years. Starting with Windows Server 2008 R2, Windows Vista and Windows 7 power plans can be defined and applied using domain policies using computer preference settings. To configure a centrally managed power plan for Windows Vista and later operating systems, perform the following steps:
  1. Log on to a designated Windows Server 2008 R2 administrative server.
  2. Click Start, click All Programs, click Administrative Tools, and select Group Policy Management.
  3. Add the necessary domains to the GPMC as required.
  4. Expand the Domains node to reveal the Group Policy Objects container.
  5. Create a new GPO called PowerProfileGPO and open it for editing.
  6. After the PowerProfileGPO is opened for editing in the Group Policy Management Editor, expand the Computer Configuration node and expand the Preferences node.
  7. Expand the Control Panel Settings, right-click the Power Options node, and select New - Power Plan (Windows Vista and Later).
  8. On the Advanced Settings page, change the default action to Update, change the default power plan from Balanced to High Performance, check checkbox Set as the Active Power Plan, and click OK to complete the settings. If desired, change any of the default settings to other values.
  9. Close the Group Policy Management Editor and link the policy in the Group Policy Management Console to a test organizational unit.
  10. Once the new policy passes validation testing, link it to a production organizational unit as desired.




NetApp Volume - Fixed Filesystem Size error




NETAPP VOLUME HAS THE FIXED FILESYSTEM SIZE OPTION SET


The following error is reported when trying to alter the size of a destination flex vol that is in a SnapMirror relation, or that was in a SnapMirror relation.
I most often run into this on volumes that were migrated off older hardware and no longer in a SnapMirror relation, but the fs_size_fixed option is not automatically changed after relationship is broken.
FS_SIZE_FIXED
This option causes the file system to remain the same size and not grow or shrink when a SnapMirrored volume relationship is broken, or when a volume add is performed on it. It is automatically set to true when a volume becomes a SnapMirrored volume. It stays set to true after the snapmirror break command is issued for the volume. This allows a volume to be SnapMirrored back to the source without needing to add disks to the source volume. If the volume is a traditional volume and the size is larger than the file system size, setting this option to false forces the file system to grow to the size of the volume. If the volume is a flexible volume and the volume size is larger than the file system size, setting this option to false forces the volume size to equal the file system size.
TO CHANGE THE OPTION IN DATA ONTAP 7-MODE:
vol options volumename fs_size_fixed off  
TO CHANGE THE OPTION IN CLUSTERED DATA ONTAP:
volume modify -filesys-size-fixed false -volume volumename  
TO CHANGE THE OPTION USING DATA ONTAP POWERSHELL TOOLKIT, 7-MODE:
Get-NaVol volumename | Set-NaVolOption -key fs_size_fixed -value off  
TO CHANGE THE OPTION USING DATA ONTAP POWERSHELL TOOLKIT, CLUSTERED DATA ONTAP:
Get-NcVol volumename | Set-NcVolOption -key fs_size_fixed -value off  

четверг, 28 ноября 2019 г.

Environment variables for PATH

First, we will be engaged in showing a path,
then we will advance to setting a path.

To show the path in CMD, use these commands:
PATH
or
SET PATH
(the last command adds info about path extensions, such as .COM;.EXE;.BAT;.CMD, etc)

If you want to show a path in a fine manner (row by row), use the next formula:
echo %PATH:;=&echo.%


In the PowerShell you need to use another command:
echo $Env:PATH


There is a more modern command SETX, for example:
setx path "%PATH%;C:\path\to\directory\"

For setting a path permanently, you may add /M switch:
setx /M path "%PATH%;C:\path\to\directory\"

That's all for today.


вторник, 19 ноября 2019 г.

RDP configuration

If you frequently use RDP connections, you may find a specialized application helpful, but there are times when regular RDP connections are necessary. In such cases, the following tips may prove useful.

·         Start Remote Desktop in full-screen mode: mstsc /f
·         Start Remote Desktop in Admin Mode: mstsc /admin
·         Matches your Remote Desktop session with the local virtual desktop: mstsc /span
·         Matches your Remote Desktop session to the Client Layout: mstsc /multimon
·         Open the .RDP file for editing—change “connection file” to your file name before running the command: mstsc /edit “connection file”

Once your Remote Desktop connection is established, you can use the following shortcuts:

·         Switches your Remote Desktop client between full-screen and windowed mode: Ctrl + Alt + Pause
·         Force the Remote Desktop into full-screen mode: Ctrl + Alt + Break
·         Takes a screenshot of the active Remote Desktop window: Ctrl + Alt + Minus
·         Takes a screenshot of the entire Remote Desktop: Ctrl + Alt + Plus
·         Reboots the remote computer: Ctrl + Alt + End

·         autoreconnection enabled:i:1
·         autoreconnect max retries:i:200
·         connection type:i:6 (LAN 10Mbps or higher)
·         connection type:i:7 (Automatic bandwidth detection)
·         networkautodetect:i:0
To specify a pre-defined window size for your Remote Desktop connection, add the following option:
·         desktop size id:i:[option number]
·         smart sizing:i:1
·         keyboardhook:i:1
·         redirectclipboard:i:1


понедельник, 9 сентября 2019 г.

3 ways to compute file Hash

Sometimes we need to get the hash of some file.
I, for example, needed it for excluding a file from antivirus scanning.
There can be other reasons for that.

# PowersShell way
get-filehash C:\setup.exe

You may use a mini-script for saving a hash for future use.
$Hash = Get-FileHash C:\setup.exe
$Hash.Hash | Out-File C:\setup.Hash.txt

Or one-liner:
(Get-FileHash C:\setup.exe).Hash | Out-File C:\setup.Hash.txt

# Get Hash with CertUtil (CertUtil exists in every Windows)
certUtil -hashfile C:\file.zip MD5
(instead of MD5 you may use other HashAlgorithms:
MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512)

# Hash with CertUtil + PowerShell (in *nix style)
$(CertUtil -hashfile C:\TEMP\MyDataFile.img MD5)[1] -replace " ",""

# Use doskey
doskey sha1sum=powershell get-filehash -algorithm sha1 "$1"
doskey md5sum=powershell get-filehash -algorithm md5 "$1"









воскресенье, 25 августа 2019 г.

Remote Group Policy update

I would like to present three different methods for remotely updating Group Policy (GPO):

1.
PsExec \\Computername Gpupdate

This window will be visible for 3 to 5 seconds:


  1. In the Group Policy Management Console (GPMC) of Windows Server 2012 and later, there is a lesser-known option to update a GPO by right-clicking on it and selecting "Group Policy Update." This will update not only the OU itself but also all sub-OUs.


As a bonus, this option will also display the number of computers in the OU, as well as all sub-OUs, which could be a useful and surprising feature!



After selecting "Yes" in the prompt, a window will appear displaying which computers have successfully applied a policy or failed to apply it.



3. As usual, there is also a PowerShell cmdlet available for this task.
Invoke-GPUpdate -Computer ComputerName -RandomDelayInMinutes 0 -Force

Alternatively, you can use a script to update Group Policy for the entire domain:
$Computers = Get-ADComputer -Filter *
$Computers | ForEach-Object -Process {Invoke-GPUpdate -Computer $_.name -RandomDelayInMinutes 0 -Force}

End!


пятница, 2 августа 2019 г.

Problem with right-click in Windows Explorer

If  you have a problem with right-click in Windows Explorer, try to use this method:

dism.exe /online /cleanup-image /scanhealth 
dism.exe /online /cleanup-image /restorehealth