вторник, 10 января 2017 г.

Cool Time Zone Converter

Enjoy:

https://www.timeanddate.com/worldclock/converter.html

General OpenSSL Commands

===Generate a new private key and Certificate Signing Request===
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
===Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info)===
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt
===Generate a certificate signing request (CSR) for an existing private key===
openssl req -out CSR.csr -key privateKey.key -new
===Generate a certificate signing request based on an existing certificate===
openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key
===Remove a passphrase from a private key===
openssl rsa -in privateKey.pem -out newPrivateKey.pem

==Checking Using OpenSSL==

If you need to check the information within a Certificate, CSR or Private Key, use these commands. You can also check CSRs and check certificates using our online tools.

===Check a Certificate Signing Request (CSR)===
openssl req -text -noout -verify -in CSR.csr
===Check a private key===
openssl rsa -in privateKey.key -check
===Check a certificate===
openssl x509 -in certificate.crt -text -noout
===Check a PKCS#12 file (.pfx or .p12)===
openssl pkcs12 -info -in keyStore.p12

Allow non-administrators RDP Access to Domain Controller

Step-by-step guide

  1. net localgroup "Remote Desktop Users"
  2. net localgroup "Remote Desktop Users" /add corp\vasya.pupkin
  3. open gpedit.msc
  4. Go to Computer Configuration -> Windows settings -> Security Settings -> Local policies -> User Rights Assignment
  5. Find the policy Allow log on through Remote Desktop Services
  6. Edit the policy by adding the local group Remote Desktop Users (like this: corp\Remote Desktop Users), a domain user, or a group (like this: corp\ras-users) to it
  7. gpupdate /force
  8. Enjoy!

Set Time Zone for the mailbox with Powershell

Open Powershell As Administrator and connect to Office365  

Set Time Zone for a Mailbox:


Set-MailboxRegionalConfiguration <Identity> -TimeZone <"Time Zone"> 

Example:

Set-MailboxRegionalConfiguration yourmailbox -TimeZone "Pacific Standard Time" 


Set Time Zone + Language for a Mailbox:


Set-MailboxRegionalConfiguration <Identity> -TimeZone <"Time Zone"> Language <Language Code> 

Example:

Set-MailboxRegionalConfiguration yourmailbox -TimeZone "Pacific Standard Time" Language en-US  


Display information about Time Zone and Language for a specific user:


Get-MailboxRegionalConfiguration <Identity> 

Example:

Get-MailboxRegionalConfiguration yourmailbox

Display Time zone and Language settings for all users:


$Users = Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} $Users | Get-MailboxRegionalConfiguration  

Error message “Error when reading from SSL socket connection” when launching Remote console on a Dell DRAC server using the Java Plug-in Type.

Solution: 

  1.  Open java.security file located in 
    1. C:Program FilesJava%java_version%libsecurity
      1. Note %java_version% will actually be the version of Java you have installed on your machine. Such as if you have installed JRE 1.8 Update 31 you would see the following path “C:Program FilesJavajre1.8.0_31libsecurity” 
  2. Comment out the following line by adding a #
    1. “jdk.tls.disabledAlgorithms=SSLv3”

How to reset grace period on Windows 2008/2012/2012R2 terminal Server

Step-by-step guide

  1. make your user's account owner of this register element:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
  2. The solution was to delete the REG_BINARY in
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
    Only leaving the default.



How to check Windows RDS grace period remaining days

Step-by-step guide

  1. Logon to your server as an administrator Start--All Programs--Accessories--Right-Click on Command Prompt and choose Run as Administrator
  2. Enter the following command:
wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !="") CALL GetGracePeriodDays

Example:



    3. Enjoy!

понедельник, 9 января 2017 г.

Export\Import NPS configuration with Powershell

Powershell comandlets for export and import Network Access Policy configuration

Step-by-step guide

  1. For export:  
    Export-NpsConfiguration -Path "C:\Npsconfig.xml"
  2. For import: 
    Import-NpsConfiguration -Path "C:\Npsconfig.xml"

Connection failed error with SuperMicro IPMI

Step-by-step guide

  1. login to IPMI page
  2. Choose tab "Maintenance"
  3. Choose "IKVM Reset"
  4. Enjoy!

Connect to Exchange Online with Powershell

Step-by-step guide


  1. Install MSOnline Sign-In Assistant for Windows Powershell http://go.microsoft.com/fwlink/?LinkID=286152
  2. Install Azure Active Directory Module for Windows Powershell   http://go.microsoft.com/fwlink/p/?linkid=236297
  3. Open Azure Active Directory Module for Windows Powershell   
  4. Connect to MSOnline services:  
    $msolcred = get-credential
    connect-msolservice -credential $msolcred
  5. Enjoy!

Share meeting room with shared organization


1. $UserCredential = Get-Credential
2.  $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
3.  Import-PSSession $Session
4.  Set-CalendarProcessing –Identity calendar@mydomain.com -ProcessExternalMeetingMessages $true
5.  Enjoy!

Manage Distribution Groups




Create Distribution Group


Syntax:

New-DistributionGroup -Name "<Distribution Group Name>" 
Example:
New-DistributionGroup -Name new-group 



Create Distribution Group with settings:


Syntax:

New-DistributionGroup -Name <DL name> -DisplayName <DL display name> -Alias <Alias> -PrimarySmtpAddress <Email Address>
Example:
New-DistributionGroup -Name new-group -DisplayName new-group -Alias new-group  -PrimarySmtpAddress new-group@mydomain.com




Add Users to Distribution Group:



Syntax:

Add-DistributionGroupMember "new-group" -Member vpupkin -BypassSecurityGroupManagerCheck

Example:

Add-DistributionGroupMember "new-group" -Member vpupkin -BypassSecurityGroupManagerCheck


Set Owner of Dustribution Group:


Syntax:

Set-DistributionGroup -Identity "<Distribution Group Name>" ManagedBy <Identity> -BypassSecurityGroupManagerCheck

Example:

Set-DistributionGroup -Identity new-group ManagedBy vpupkin  -BypassSecurityGroupManagerCheck



Remove Distribution Group:


Syntax:

Remove-DistributionGroup "<Distribution Group Name>"
Example:
Remove-DistributionGroup new-group


Add Email Aliases for Distribution Group:


Syntax:

Set-DistributionGroup "<Distribution Group Name>" -EmailAddresses SMTP:<Primary Email>,<Alias Email>
Example:

Set-DistributionGroup new-group-EmailAddresses SMTP:new-group@mydomain.com,achtung@mydomain.com


Hide Distribution Group from GAL (Global Address List):


Syntax:

Set-DistributionGroup "<Distribution Group Name>" -HiddenFromAddressListsEnabled $True
Example:
Set-DistributionGroup new-group -HiddenFromAddressListsEnabled $True



Get Information about Distribution Group members:



Syntax:

Get-DistributionGroupMember "Group Name>"

Example:

Get-DistributionGroupMember new-group

Get List of Distribution Groups:

Get-DistributionGroup  




Enjoy!

Useful cmdlets for Sharepoint Online

1) Before start working with SPO's powershell cmdlest you have to download those cmdlets. You can do it here: click me
2) Once installed open the SharePoint Online Management Shell by clicking Start > All Programs > SharePoint Online Management Shell > SharePoint Online Management Shell (As Administrator)
3) Getting Connected:  

Connect-SPOService -Url https:mydomain.sharepoint.com -Credential vasyapupkin@mydomain.com

SPO Cmdlets

Site Groups:

  • Get-SPOSiteGroup – Get a Site Collection Site Group.
  • New-SPOSiteGroup – Create a new Site Collection Site Group.
  • Remove-SPOSiteGroup – Remove an existing Site Collection Site Group.
  • Set-SPOSiteGroup – Set the permission level and/or owner of an existing Site Collection Site Group.

Users:

  • Add-SPOUser – Add a user to an existing Site Collection Site Group.
  • Get-SPOUser – Get an existing user.
  • Remove-SPOUser – Remove an existing user from the Site Collection or from an existing Site Collection Group.
  • Set-SPOUser – Set whether an existing Site Collection user is a Site Collection administrator or not.
  • Get-SPOExternalUser – Returns external users from the tenant’s folder.
  • Remove-SPOExternalUser - Removes a collection of external users from the tenancy's folder.

Site Collections:

  • Get-SPOSite – Retrieve an existing Site Collection.
  • New-SPOSite – Create a new Site Collection.
  • Remove-SPOSite – Move an existing Site Collection to the recycle bin.
  • Repair-SPOSite – If any failed Site Collection scoped health check rules can perform an automatic repair then initiate the repair.
  • Set-SPOSite – Set the Owner, Title, Storage Quota, Storage Quota Warning Level, Resource Quota, Resource Quota Warning Level, Locale ID, and/or whether the Site Collection allows Self Service Upgrade.
  • Test-SPOSite – Run all Site Collection health check rules against the specified Site Collection.
  • Upgrade-SPOSite – Upgrade the Site Collection. This can do a build-to-build (e.g., RTM to SP1) upgrade or a version-to-version (e.g., 2010 to 2013) upgrade. Use the -VersionUpgrade parameter for a version-to-version upgrade.
  • Get-SPODeletedSite – Get a Site Collection from the recycle bin.
  • Remove-SPODeletedSite – Remove a Site Collection from the recycle bin (permanently deletes it).
  • Restore-SPODeletedSite – Restores an item from the recycle bin.
  • Request-SPOUpgradeEvaluationSite - Creates a copy of the specified Site Collection and performs an upgrade on that copy.
  • Get-SPOWebTemplate – Get a list of all available web templates.

Tenants:

  • Get-SPOTenant – Retrieves information about the subscription tenant. This includes the Storage Quota size, Storage Quota Allocated (used), Resource Quota size, Resource Quota Allocated (used), Compatibility Range (14-14, 14-15, or 15-15), whether External Services are enabled, and the No Access Redirect URL.
  • Get-SPOTenantLogEntry – Retrieves company logs (as of B2 only BCS logs are available).
  • Get-SPOTenantLogLastAvailableTimeInUtc – Returns the time when the logs are collected.
  • Set-SPOTenant – Sets the Minimum and Maximum Compatibility Level, whether External Services are enabled, and the No Access Redirect URL.

Apps:

  • Get-SPOAppErrors – Returns application errors.
  • Get-SPOAppInfo – Returns all installed applications.

Connections:

  • Connect-SPOService – Establishes a connection to a SharePoint Online Tenant Administration Site.
  • Disconnect-SPOService – Clears an existing connection.

Enjoy!

Deleted Exchange Calendar item keeps coming back


  1. Connect to Office365 with Powershell
  2. Disable Callendar Repair Assistant with command:    Set-Mailbox vasya@yourdomain.com -CalendarRepairDisabled $true



The Calendar Repair Assistant performs the following functions:
  • Detects inconsistencies
  • Determines if inconsistencies were intentional
  • Corrects inconsistencies 
  • Sends a calendar repair update message if a correction was made
       3. Search and Delete required meeting in calendars:    Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'from:"vasya@yourdomain.com" AND kind:meetings AND SUBJECT:"Type your subject"' -DeleteContent -Force
       4. Just for case if you are looking for another content removal:

–SearchQuery kind:contacts
–SearchQuery kind:notes
–SearchQuery kind:tasks
–SearchQuery kind:im
–SearchQuery kind:email


      5. Enjoy!

Connect to Office365 with Powershell


Step-by-step guide

  1. Run Windows Powershell as Administrator
  2. Login to Office365 with your admin account with command:  
    $LiveCred = Get-Credential



         3.  Import session for Office365 manage:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection