Category Archives: Active Directory

Move log files according to file name to separate folder

Here is the link for the script I am using for automatic moving log files to separate folder according to them name (Version 2.0).

According to file name…

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your logs and temporary file to use (change the brackets to relevant data, NO NEED BRACKETS!!!):

$path1 = “[Folder to look for logs]”
$csvfile1 = “[Temporary CSV file]”

I will be glade to get suggestions…

Thanks

Tal

Get disk space report and send once a weekly to email

Here is the link for the script I am using for email notification regard disk space and daily report (Version 2.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your domain and you server list runs from it (change the brackets to relevant data, NO NEED BRACKETS!!!):

$serverlist = “[Server list to check]” #server.txt
$Reports = “[Location where to place report]”
$sender = “Scripts@[domain].com”
$SMTPServer = “[SMTPServer]”
$Recipient = “[xxx@domain.com]”

I will be glade to get suggestions…

Thanks

Tal

Create report regard IP existing in range

Here is the link for the script I am using to create report regard IP existing in range of class ‘C’ (Version 2.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your list and report file location (change the brackets to relevant data, NO NEED BRACKETS!!!):

$iplist1 = @(“192.168.0.”,”192.168.1.”)
$DestPath = “[location to place the report]”

I will be glade to get suggestions…

Thanks

Tal

Create server/PC/Laptops list from Active Directory

Here is the link for the script I am using to create server/PC/Laptops lists from Active Directory (Version 2.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your list files (change the brackets to relevant data, NO NEED BRACKETS!!!):

$LTfile = “[Laptops list]” #xxxxxxlt.txt laptops suffix is “-LT”
$Pcfile = “[Desktops list]” #xxxxxxpc.txt desktops suffix is “-PC”
$SRVfile = “[Servers list]” #xxxxxxsrv.txt

I will be glade to get suggestions…

Thanks

Tal

Zip event logs files and move to other location

Here is the link for the script I am using zip event logs files and move to other location (Version 1.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your needs and you servers to check (change the brackets to relevant data, NO NEED BRACKETS!!!):

$ComputerName = (“Server1″,”Server2″,”Server3″,”Server4”)
$Syslogs = “[File location to move to…]”
$Path2003 = “c$WINDOWSsystem32config”
$Path2008 = “c$WINDOWSSystem32WinevtLogs”
$sender = “Script@[domain].com”
$subject1 = “Archive Security Event Log”
$smtpsrv = “[SMTPSERVER]”
$Recepionist = “xxx@[domain].com”
$filter1 = “Archive*.evt”
$Source = “Archive-Security”
$Dest = “sec”

I will be glade to get suggestions…

Thanks

Tal

Create new account with shared account associate

Here is the link for the script I am using to create new account user and additional shared mailbox associate for the user (Version 2.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your domain and you server it runs from it (change the brackets to relevant data, NO NEED BRACKETS!!!):

$OOU = “[domain.com/Sales]”
$SOU = “[domain.com/Sites Recipients]”
$SSuffix = “@[domain.com]”
$MailFrom = “[test@domain.com]”
$OSuffix = “@[SharedDomain.com]”
$SMail = $SAlias+”@[domain.com]”
$GrouptoAdd = “[Group Name to Add permissions]”
$GrouptoAdd2 = “[2nd Group Name to Add permissions]”
$SmtpServer =”[SMTP server]”

I will be glade to get suggestions…

Thanks

Tal

Create second folder according personal folder

Here is the link for the script I am using to create additional personal folders (Version 2.0).

It is compare between two folders and create folders with same permissions as in the first.

I am running this script from scheduler every day to create second personal folders for new users created in my domain.

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command”

Download the Script and rename the suffix from .txt to .ps1

On the first section you need to feel relevant data for your domain, your file location, your servers and emails for update when creation occur (change the brackets to relevant data, NO NEED BRACKETS!!!):

$tempfile1 = “D:TempUsersPST.txt”
$tempfile2 = “D:TempUsersDataNotInUsersPST.txt”
$tempfile3 = “D:TempUsersDataInUsersPST.txt”
$tempfile4 = “D:TempUsersData.txt”
$smtpServer = “[SMTPSERVER]”
$path1 = “[Second Location for personal Folder]”
$path4 = “[First Location of personal Folder]”
$Sender = “[Script@domain.com]”
$Receptions = “[1stContact@domain.com,2ndContact@domain.com]”
$Subject = “Second personal folder created for users”

I will be glade to get suggestions…

Thanks

Tal

PowerShell script to send reminder email about password expiration

Here is the link for the script I am using for email notification regard password expiration (Version 2.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command C:ScheduleTasksactive_directory_expiration.ps1”

Download the Script and rename the suffix from .txt to .ps1

 

On the first section you need to feel relevant data for your domain and you server it runs from it (change the brackets to relevant data, NO NEED BRACKETS!!!):

	$domainsuf = "@[domin.com]"
	$logpath = "[C:ScheduleTasksLogs]"
	$smtpsrv = "[SMTPSERVER]"
	$SearchBase1 = "[OU=Sales,DC=Domain,DC=com]"
	$SearchBase2 = "[CN=Users,DC=Domain,DC=com]"
	$LogFile = $logpath + "[expired_log.csv]"
	$Domain = "[NetBios Domain Name]"

 

 

 

 

 

 

I will be glade to get suggestions…

Thanks

Tal

Active Directory promotion failed in remote branch

The operation failed because:

This kerberos hack only applies in WAN environments with MTU issues.

You can change MaxPacketSize to 1 to force the clients to use Kerberos traffic over TCP. To do this, follow these steps:

1. Start Registry Editor.
2. Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINESystemCurrentControlSetControlLsa KerberosParameters
Note If the Parameters key does not exist, create it now.
3. On the Edit menu, point to New, and then click DWORD Value.
4. Type MaxPacketSize, and then press ENTER.
5. Double-click MaxPacketSize, type 1 in the Value data box, click to select the Decimal option, and then click OK.
6. Quit Registry Editor.
7. Restart your computer.