powershell (ru)

powershell (ru)

  • Generate complex password in two strings in Powershell Generate complex password in two strings in Powershell

    Usually, I generate passwords for my users by closing my eyes and chaotically pressing the buttons on keyboard. There is a new way now - I can generate it in Powershell easily:

  • Export address book directly from the server in Lync 2010/2013 While working with address book in Lync Server, sometimes its very important and convinient to know, what exactly Lync Server have in its database regarding address book. You will need this, for example, when you working with Active Directory attributes that will be shown in contact card in Lync client.
  • Running Powershell script in scheduled task

    Like any other scripts, you will need to run Powershell-scripts not in manual mode, but as a scheduled task.

    For example, mass importing and actualizing Lync Server users database you will need to run every one-two-three hours.

    Of course, Task Scheduler in Windows should help in this issue, but how to run *.ps1 file?

  • Export Active Directory users to MS SQL Server

    Today's my script was written while i've been developing billing-system for Asterisk.

    Every user in Active Directory has an attribute with phone number. We will take this attribute and some others into MS SQL Server to use in billing.

    There are tons of scripts that can export AD users into scv-file, but none that will export users directly to SQL database. Of course we can export users into scv and then take this csv and import it into SQL database with the help of SSIS-scripts. But this method will generate two scripts, and if you have more than 5-10-15 AD domains, you will have 10-20-30 scripts, which is likely will lead to errors.

  • Export array (table) into csv-file in Powershell In your work in big arrays of data in Powershell, very often you will need to export data to table and after open this table in Excel. Its not recommended to code direct export from array into Excel-file, because you will need Excel installed on computer where you run the script. Also, such a code will run slowly.
    So, I've decided to export data to csv-file.
  • Removing Ghost-Mailboxes from Exchange 2010/2013

    In Exchange you can encounter issues when you move mailbox between databases. And after this issues you can have, for example, 2 (or several) mailboxes in your databases which belongs to a single user. And of course, only one mailbox from them linked to Active Directory user account.

    And one more thing - mailboxes that are not used, NOT marked as Disconnectedor SoftDeleted.

    These mailbox are known as ghost-mailboxes.

  • [Powershell Basics] Find a path for Powershell modules in your system

    When you downloading some modules for Powershell, you will need to install that modules. Powershell module - is a folder. You will copy module folder to modules repository (also a folder).

    How to find modules repository folder?

    PS H:\> $env:PSModulePath -split ';'
    C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules

    In other system:

  • [Powershell Basics] Find substring in string array [Powershell Basics] Find substring in string array

    Imagine that you have array of strings (email addresses for example):




    You have a task - find email addresses in domain domain.ru among these strings.

  • Deleting old files and folders in Powershell

    Task is clear from title - we need to delete old files from some directory. There are many cases in life, when you will need to perform such operation. For example - delete old backups.