This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-UsernameSID($AccountName) { | |
| $NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName) | |
| $NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier]) | |
| return $NTUserSID.Value | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #https://stackoverflow.com/a/47262639 | |
| $devices = Get-PnpDevice| where {$_.class -eq "Display" -and $_.FriendlyName -notmatch "^.*Microsoft.*|^.*Basic.*|^.*Vmware.*"} | |
| foreach ($dev in $devices) { | |
| $dev | Disable-PnpDevice -Confirm:$false | |
| $dev | Enable-PnpDevice -Confirm:$false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://www.outsidethebox.ms/19318/ | |
| # This is preferred way to disable prefetch in Windows 10. Disabling SysMain service is not recommended: | |
| # https://docs.microsoft.com/en-us/windows-server/security/windows-services/security-guidelines-for-disabling-system-services-in-windows-server#superfetch | |
| # 3 - enables prefetching for Windows and API, | |
| # 2 - enables only for API, | |
| # 0 - disables completely. | |
| reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" /v "EnablePrefetcher" /t REG_DWORD /d "0" /f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability –Online |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-Disk | Where partitionstyle -eq 'raw' | | |
| Initialize-Disk -PartitionStyle gpt -PassThru | | |
| New-Partition -AssignDriveLetter -UseMaximumSize | | |
| Format-Volume -FileSystem NTFS -NewFileSystemLabel "Data" -Confirm:$false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $Secure = Read-Host -AsSecureString | |
| # input password: ********** | |
| $hash = ConvertFrom-SecureString -SecureString $Secure | |
| # get hash | |
| $password = ConvertTo-SecureString -String $hash | |
| # use hashed password in cmdlets | |
| New-LocalUser -User $user -password $password -PasswordNeverExpires:$true -AccountNeverExpires:$true | |
| ### | |
| ### decrypt password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :: Set High performance power scheme | |
| powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c | |
| :: Adjust graphics driver delay time (useful for old gpus, e.g. nvidia gtx 660) | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" /v "TdrDdiDelay" /t REG_DWORD /d "20" /f | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" /v "TdrDelay" /t REG_DWORD /d "20" /f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "DisableTaskOffload" /t REG_DWORD /d "1" /f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| netsh advfirewall firewall add rule name="Program Blocked with Batchfile" dir=out program="C:\Program Files\Program\Program.exe" action=block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :: add end user ability to create sockets as non-admin user | |
| :: netsh http add urlacl url=http://+:6000/ user="NT AUTHORITY\Authenticated Users" listen=yes | |
| netsh http add urlacl url=http://+:6000/ user="NT AUTHORITY\Прошедшие проверку" listen=yes |
NewerOlder