Thursday, May 28, 2020

DNS Scavening not working

IF DNS Scavenging is enabled on the server , configured  the Scavenging Cycle and Aging (No Refresh and Refresh interval)  but old records are not deleting yet,

type in cmd dnscmd /zoneinfo test.com


you will see ....Ptr          = 000000000031D480               MaxCount     = 1                AddrCount    = 1                                Server[0] => af=2, salen=16, [sub=0, flag=00000000] p=13568, addr=192.168.1.1


Here you notice the IP address 192.168.1.1.


This is the IP address of the server which has the permission to scavenge the zone (Most likely this could be a server which is no longer existing)
If this is not the IP address of the server which on which you have configured Scavenging then we need to change that.


To change the Scavenging server for a zone, run the command:


dnscmd /zoneresetscavengeservers test.com <Ip of the current DNS Server>


where <IP of the current DNS Server> is the IP address of the DNS Server where Scavenging is configured.


Source

Tuesday, March 10, 2020

Generate random password in Powershell

$characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ'
$nonchar = '123456789!$%&?+#'
$length = 15  #The total length will be 15, the last two characters are nonchar.

# select random characters
$random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length }
$random2 = 1..2 | ForEach-Object { Get-Random -Maximum $nonchar.length }

$private:ofs= ""
$password = [String]$characters[$random] + [String]$nonchar[$random2]
return $password

Wednesday, January 22, 2020

Get list of un protected OU's

To get locating OUs that isn't protected from accidental deletion in AD

Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false}

Tuesday, January 14, 2020

Active Directory – SID Filtering

Run Powershell as Enterprise Administrator:

to Deactivate Sid Filter:

Netdom trust <TrustingDomainName> /domain:<TrustedDomainName> /quarantine:No

to Activate:

Netdom trust <TrustingDomainName> /domain:<TrustedDomainName> /enablesidhistory:Yes

Source

Sunday, September 8, 2019

Program always run as Administrator

create a new shortcut, and paste

runas /user:ComputerName\Administrator /savecred “C:\Path\To\Program.exe"

Hide Unwanted Fields On Calendar Form

<script src="/SiteAssets/Scripts/jquery-1.8.0.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready( function() {
$("TABLE.ms-formtable>TBODY>TR:eq(1)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(5)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(6)").css('display', 'none');
})</script>

Sharepoint hide left menu

<style type="text/css">
 #sideNavBox {DISPLAY: none}
 #contentBox {MARGIN-LEFT: 5px}
</style>

Thursday, August 15, 2019

Move members of group to another OU

$OU = "OU=Users,OU=Test,DC=test,DC=com"
Get-ADGroupMember -Server test.com -Identity 'probation-'test-group' | foreach { Move-ADObject -server test.com -Identity $_.DistinguishedName -TargetPath $OU}

Thursday, June 20, 2019

Migrate DC 2008r2 to 2016/2019



Dcdiag /e /test:sysvolcheck /test:advertising

Dfsrmig /setglobalstate 1

Dfsrmig /getmigrationstate

Dfsrmig /setglobalstate 2

Dfsrmig /getmigrationstate

Dfsrmig /setglobalstate 3

Dfsrmig /getmigrationstate


sourse: https://www.youtube.com/watch?v=jl4vo5rD18A

Friday, January 25, 2019

Chrome Home page GPO

https://ittutorials.net/microsoft/windows-server-2016/gpo-google-chrome/

Tuesday, January 22, 2019

Create universal Image

Shift + ctrl + F3 Audit Mode

Friday, January 18, 2019

Configure Sharepoint Search


1) Add MultiStringValue to Registry name BackConnectionHostNames
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0

add Site FQDN names
for example: intranet.contoso.com


2) iireset /noforce

https://www.youtube.com/watch?v=LtjkBFVc35M

Tuesday, January 8, 2019

Remove Computers from txt list powershell

Import-Module ActiveDirectory
$PCs = Get-content c:\tmp\fordisable.txt
foreach ($PC in $PCs)
{
Remove-ADComputer -server test.local -identity $PC -confirm:$false
}

Friday, November 16, 2018

Logon script to restart computers from list

for /F "tokens=*" %%x in ('type c:\tmp\restart.txt') do ( shutdown.exe -m "%%x" -t 0 -r -f )
pause


in txt file write computer fqdn names 

Change Mozilla Firefox home page GPO


On old versions  Mozilla ADMX does not work properly
to change home page use this bat script (create log on script policy)

---------------

echo off
cd /D "%APPDATA%\Mozilla\Firefox\Profiles"
cd *.default
set ffile=%cd%
echo %user_pref("browser.startup.homepage", );% del /f /q "%ffile%\prefs.js"
echo user_pref("browser.startup.homepage", "http://int.psh.gov.ge");>>"%ffile%\prefs.js"
set ffile=
cd %windir%

------------------


If your mozilla version is higher, than 60 version, you can you ADMX templates (Create computer base policy)

you can download here :

https://github.com/mozilla/policy-templates/releases



Monday, September 3, 2018

Disable IPv6 GPO

Add the preference will be Computer Configuration > Preferences > Windows Settings > Registry. In there, you want to add a new Registry Item, with the below settings on the General tab:

  • Action: Update
  • Hive: HKEY_LOCAL_MACHINE
  • Key Path: SYSTEM\CurrentControlSet\services\TCPIP6\Parameters
  • Value Name: DisabledComponents
  • Value Type: REG_DWORD
  • Value Data: FF
  • Base: Hexadecimal

Thursday, July 5, 2018

Extend Volume failed, but partition was extended

If you extended disk but space doesnot added to partition

Open CMD as administrator:

  1. diskpart
  2. list volume
  3. select volume x
  4. extend filesystem

Tuesday, June 19, 2018

VMware find VM by mac address

Get-VM | Get-NetworkAdapter | Where {$_.MacAddress -eq "00:50:51:b7:54:a1"} | select parent,macaddress

Monday, June 11, 2018

IIS URL redirect error

When you are using iis to redirect  proxy IIS Return 404.4 Not Found when URL Rewrite on some pages , but page exists.

Open IIS rewrite web.config  file  and add inside the <system.webServer> tag, add the following:

<security>
<requestFiltering allowDoubleEscaping="true" />
</security>

Thursday, June 7, 2018

Change Sip addresses user powershell

Change old sip address to new to all users. Open skype for business powershell  and run :

$x = Get-CsUser | Where-Object {$_.SipAddress -like "*@oldSIP"}

 foreach ($i in $x)

    {
        $oldAddress = $i.SipAddress

        $newAddress = $oldAddress -replace "@oldSIP", "@newSIP"

        Set-CsUser -Identity $i.Identity -SipAddress $newAddress
    }