• Home
  • PS
  • C#
  • Perl
  • MSSQL
  • MariaDB
  • Linux
  • Docker
  • MacOS
  • PG
  • Exchange Server
  • Windows
  • Other

Home

Инвентаризация ПО в компании

Details
Written by: Senka
Category: Power Shell
Created: 11 June 2013
Hits: 1336

Import-Module ActiveDirectory

$computers = Get-ADComputer -filter * -Properties * | Select Name,OperatingSystem,OperatingSystemVersion,OperatingSystemServicePack,PrimaryGroup, IPv4Address,IPv6Address,CanonicalName,WhenCreated,LastlogonTimestamp, PasswordLastSet,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}| ?{$_.Disabled -eq 0}

 

Read more …

Тестируем скорость открытия файлов из шары

Details
Written by: Senka
Category: Power Shell
Created: 11 June 2013
Hits: 1216

Get-Content "filetest.txt" | ForEach-Object {$t1 = get-date -Format hh:mm:ss.fff; $content = Get-ChildItem $_ | Select-Object -First 1 *; $t2 = get-date -Format hh:mm:ss.fff; echo $t1`t$t2`t$_ } 

Создание контактов в Exchange

Details
Written by: Senka
Category: Exchange Server
Created: 11 June 2013
Hits: 1383

param ($i,$f,$mail)

$match = [regex]::Match($mail,"^([a-z]+\.[a-z]+)@.+$")

$alias = $match.groups[1].value

New-MailContact -ExternalEmailAddress SMTP:$mail -Name "$i $f" -Alias $alias -FirstName "$i" -Initials '' -LastName "$f" -OrganizationalUnit 'Domen/Mail_contacts/OU'

Список отделов в организации

Details
Written by: Senka
Category: Power Shell
Created: 11 June 2013
Hits: 1432

Import-Module ActiveDirectory

$date = (Get-Date).AddDays(-90)

$Departments = Get-ADUser -Filter {lastlogontimestamp -gt $date} -property * | Select SamAccountName,Name,CanonicalName,EmailAddress,PasswordLastSet,WhenCreated,PasswordExpired,PasswordNeverExpires,ProfilePath,Department,Title,Manager,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}} |?{$_.Disabled -eq 0} | select Department | sort-object Department -Unique

 

Пользователи за 3 месяца и за месяц отправкой по почте

Details
Written by: Senka
Category: Power Shell
Created: 11 June 2013
Hits: 1398

 

 

Import-Module ActiveDirectory

$month3 = (Get-Date).AddMonths(-3)

$month1 = (Get-Date).AddMonths(-1)

 

$emailattachment1 = "C:\tasks\users_created_last_3month\users_last_3_month.csv"

$emailattachment2 = "C:\tasks\users_created_last_3month\users_last_1_month.csv"

 

$users3 = Get-ADUser -filter * -property * | ?{$_.Created -gt $month3} | select name,samaccountname,created,mail,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}|?{$_.Disabled -eq 0} | select name,samaccountname,created,mail |  Export-Csv $emailattachment1 -Delimiter ";" -NoTypeInformation -Encoding Default

$users1 = Get-ADUser -filter * -property * | ?{$_.Created -gt $month1} | select name,samaccountname,created,mail,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}|?{$_.Disabled -eq 0} | select name,samaccountname,created,mail | Export-Csv $emailattachment2 -Delimiter ";" -NoTypeInformation -Encoding Default

Read more …

  1. Формируем списки устаревших пользователей для руководителей

Subcategories

Power Shell Article Count:  53

C# Article Count:  10

Perl Article Count:  1

Exchange Server Article Count:  15

Other Article Count:  24

MSSQL Article Count:  17

Windows Article Count:  25

MariaDB Article Count:  3

Linux Article Count:  7

Docker Article Count:  2

pg Article Count:  1

Page 31 of 32

  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

Login Form

  • Forgot your password?
  • Forgot your username?

Statistics

  • Users 2
  • Articles 164
  • Articles View Hits 149004