Retrieve MS-SQL version info without MS SQL Studio

After digging around for a customer to update their ms-sql server for an application, I had to find out the version they were using first.

Not having the Visual studio tools installed, there’s a cmdline tool that can do this.

As an authorative user, such as Administrator, in this case, I had to go to

C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn>

(you can already see the ‘100’ that says something about the version, it can be something else, like 80, 90, etc)

Then type

SQLCMD -S server\instance

Where server is your server and instance the instance you want to connect to

You can also do

SQLCMD -L

to see a list.

Then, at >1 you can type a command, at >2 type ‘go’ to execute it.

Such as:

1> select @@version
2> go

That gives something like this:

Microsoft SQL Server 2008 R2 (SP1) – 10.50.2500.0 (Intel X86)
Jun 17 2011 00:57:23
Copyright (c) Microsoft Corporation
Express Edition on Windows NT 6.2 <X64> (Build 9200: ) (WOW64) (Hypervisor)

Or type:

1> select serverproperty('EditionID')
2> go
  • -1253826760 = Desktop
  • -1592396055 = Express
  • -1534726760 = Standard
  • 1333529388 = Workgroup
  • 1804890536 = Enterprise
  • -323382091 = Personal
  • -2117995310 = Developer
  • 610778273 = Enterprise Evaluation
  • 1044790755 = Windows Embedded SQL
  • 4161255391 = Express with Advanced Services

Or type:

1> select serverproperty('Edition')
2> go

Which in my case said “Express Edition”

Hope this helps you!

Have fun!

 

Posted in Microsoft, MS SQL | Comments Off on Retrieve MS-SQL version info without MS SQL Studio

Exchange, Disable spam filter for a receive connector

You may want to disable the spam filter for e.g. a connector that sends your invoices.

Get-ReceiveConnector "SERVER\ReceiveConnector" | Add-ADPermission 
-User "NT Authority\Anonymous Logon" 
-AccessRights ExtendedRight -ExtendedRights ms-exch-ypass-anti-spam

Hope this helps you!

 

Posted in E-mail, Exchange 2016, smtp | Comments Off on Exchange, Disable spam filter for a receive connector

(re)Setting rights on user home folders [batch script]

After some troubles with copied user home folders during a migration, the rights were set incorrectly.

As this was about more than just a handful of users, re-setting the rights manually wasn’t a good idea.

After digging around on the net, I adjusted a script so that this could be done automagically.

@echo off
setlocal
set fold="*"
set fold=%fold:"=%
for /F "tokens=*" %%i in ('dir "%1" /b /ad') do call :UPERM "%%i"
endlocal
goto end:
:UPERM
 set user=%1
 set user=%user:"=%
 echo %user%
 icacls %user% /grant "%user%":(OI)(CI)(M,RX,R,W,D)
:end

The approach on this is that the user home folder is the same as the username.
The list of directories is taken from the working directory. The subfolders that are put into a variable are the user home folders.
The script then walks through them all and sets (OI)(CI)(M,RX,R,W,D) rights using icacls, so that the users are able to get to their files again.

Look up the icacls help on setting the rights, if you want to adjust the script.

Have fun, hope this helps you.

found on https://arstechnica.com/civis/viewtopic.php?f=17&t=823972

Posted in .bat, Active Directory, batch, command line, File sharing | Comments Off on (re)Setting rights on user home folders [batch script]

Adobe Reader DC, Remove side tools panel by default

After digging around, there seems to be a solution to remove that side panel that takes up screen space, every time you  start Adobe Reader DC.

[you have to have admin rights to do this]
Go to the install directory using explorer.

C:\Program Files (x86)\Adobe\Acrobat Reader\DC\Reader\AcroApp\ENU

( If you have another language, go to another directory there, in my case “NLD”)

Create a new subfolder to move files to and move 3 files from the “ENU” folder into the newly created folder:

AppCenter_R.aapp
Home.aapp
Viewer.aapp

Open a PDF file and now there should be no tools panel.

Works with Windows10

Hope this helps you.

 

Found at https://forums.adobe.com/thread/1817184

Posted in News | Tagged , , | Comments Off on Adobe Reader DC, Remove side tools panel by default

Configure SSL on an HP Aruba 2530-48G-PoEP Switch (J9772A)

Log in admin using ssh (with your favourite ssh client) or (serial) console cable.

config
crypto pki identity-profile Profile subject

Now enter some certificate parameters
You can enter all you like, e.g.

Enter Common Name(CN) : Switch
Enter Org Unit(OU) : ICT
Enter Org Name(O) : Customer
Enter Locality(L) : Amsterdam
Enter State(ST) : State
Enter Country(C) : NL

then, type

crypto pki enroll-self-signed certificate-name certificate
web-management ssl
save

Now ssl is enabled and you can reach your switch using https.

If you didn’t configure an ip-address yet, you see the current ip address using

show ip
Posted in aruba, cli, hp, switch | Comments Off on Configure SSL on an HP Aruba 2530-48G-PoEP Switch (J9772A)

Exchange 2016 Have a receive connector relay outside the domain.

There’s a powershell cmd for that:

New-ReceiveConnector -Name "Anonymous Relay" -Usage Custom -AuthMechanism ExternalAuthoritative -PermissionGroups ExchangeServers -Bindings x.x.x.x:25 -RemoteIpRanges x.x.x.x

(or create a receive connector with the right settings) And then

Get-ReceiveConnector "Anonymous Relay" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "Ms-Exch-SMTP-Accept-Any-Recipient"
Posted in Exchange 2016, powershell | Comments Off on Exchange 2016 Have a receive connector relay outside the domain.

Exchange 2016 Restart Transport Service powershell

Ran into this earlier today, had to restart the Exchange 2016 transport service using powershell only! It turned out to be easy.

Restart-Service MSExchangeTransport

To list all Exchange services:

Get-Service *Exchange*
Posted in Exchange 2016, powershell | Comments Off on Exchange 2016 Restart Transport Service powershell

User folder displayed as “Documents”: Remove desktop.ini

A users’ folder is displayed as “Documents” and you don’t want that.

To e.g. remove desktop.ini files (which are hidden: use -force):

Get-ChildItem "\\SERVER\d$\Users\Userdata\" -recurse -filter desktop.ini -force | foreach ($_) {remove-item $_.fullname -force}

This deletes all the desktop.ini files and will help you see the normal folder structure.
It may be nasty for the users.. or not. Up to you.

Found at http://www.kevin-burke.co.uk/windows-server-technologies/home-folder-shows-documents-folder/

 

Hope this helps you!

Posted in File sharing, powershell | Comments Off on User folder displayed as “Documents”: Remove desktop.ini

Sonicwall OID’s

For internal purposes I had to monitor some snmp facts of a sonicwall.

Here’s the OID list

Sonicwall CPU usage as percent
.1.3.6.1.4.1.8741.1.3.1.3.0
 
Sonicwall Memory usage as percent
.1.3.6.1.4.1.8741.1.3.1.4.0
 
Sonicwall Maximum Connections
.1.3.6.1.4.1.8741.1.3.1.1.0

Sonicwall Current Connections
.1.3.6.1.4.1.8741.1.3.1.2.0
 
Sonicwall Firmware version: 
.1.3.6.1.4.1.8741.2.1.1.3.0

Sonicwall Serial:
.1.3.6.1.4.1.8741.2.1.1.2.0

Sonicwall ROM:
.1.3.6.1.4.1.8741.2.1.1.4.0

Sonicwall System Description:
.1.3.6.1.2.1.1.1.0

Luck may vary (there are many different type of (Dell) Sonicwall appliances)

Hope this helps you.

Posted in OID, snmp | Comments Off on Sonicwall OID’s

Get all different types of mailboxes in Exchange 2010 and 2016

I had to get the amount of the different types of mailboxes that are available in Exchange.
Exchange 2010 and 2016 in this case.

As I had to execute this as a script I ran into the problem that you have a ‘bare’ powershell and thus first need to connect to Exchange.

For Exchange 2010, note the name of the snapin.

Exchange 2010 – Get Number of all Mailboxes (including +1 for a system mailbox)

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
(get-mailbox -resultsize unlimited).count

Exchange 2010 – Get Number of Equipment Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-mailbox -recipienttypedetails EquipmentMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Exchange 2010 – Get Number of Room Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-mailbox -recipienttypedetails RoomMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Exchange 2010 – Get Number of Shared Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-mailbox -recipienttypedetails SharedMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Exchange 2010 – Get Number of User Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-mailbox -recipienttypedetails UserMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

 

For Exchange 2016, note the name of the snapin. The actual powershell commands to receive the info are the same as with Exchange 2010.

Exchange 2016 – Get Number of all Mailboxes (including +1 for a system mailbox)

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin
(get-mailbox -resultsize unlimited).count

Exchange 2016 – Get Number of Equipment Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin
Get-mailbox -recipienttypedetails EquipmentMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Exchange 2016 – Get Number of Room Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin
Get-mailbox -recipienttypedetails RoomMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Exchange 2016 – Get Number of Shared Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin
Get-mailbox -recipienttypedetails SharedMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Exchange 2016 – Get Number of User Mailboxes

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin
Get-mailbox -recipienttypedetails UserMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count

Hope this helps you!
Cheers!

Posted in Exchange 2010, Exchange 2016, powershell | Comments Off on Get all different types of mailboxes in Exchange 2010 and 2016