Archive

Author Archive

Test-NetConnection the new Ping?


In Windows Server 2012 R2 Microsoft added a new PowerShell command for testing your network Connection. (It works with WIndows 8.1 also)
Can it be used for “The New ping” ? it sure can! 🙂

The Test-NetConnection cmdlet displays diagnostic information for a connection. The output includes the results of a DNS lookup, a listing of IP interfaces, an option to test a TCP connection, IPsec rules, and confirmation of connection establishment.

The command is:
Test-NetConnection “url/ip”

open PowerShell and type:

Test-NetConnection vg.no (where “vg.no” is an url or ip that you want to ping)

test-netconnection

if you want to go more Advanced try this:

Test-NetConnection vg.no -tracerout

test-netconnection-tracert

or maybe you want to do an telnet and check the for an port:

Test-NetConnection vg.no http or Test-NetConnection vg.no -port 443

idefix_3

 

For more information about this New Nice feature for Windows Server 2012 R2 visit TechNet:
http://technet.microsoft.com/en-us/library/dn372891.aspx

AD: Count users in organizational units

October 23, 2013 1 comment

To count user accounts in an organizational unit, run this powershell command:

(Get-ADUser -Filter * -SearchBase “ou=Users,ou=A1,dc=contoso,dc=com”).count

Where “ou=” is the path for your OU and “dc=” is yorur domain. My query runs against “contoso.com\users”

Tags: ,

Reporting Server Error 1053: The service did not respond to the start or control request in a timely fashion


If you have problems starting Reporting Services, the problem may be that the service times out when trying to start.
To fix this problem follow the guide below:

1.  Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

3. In the right pane, locate the ServicesPipeTimeout entry.

Note If the ServicesPipeTimeout entry does not exist, you must create it. To do this, follow these steps:

a. On the Edit menu, point to New, and then click DWORD Value.
b. Type ServicesPipeTimeout, and then press ENTER.
4. Right-click ServicesPipeTimeout, and then click Modify.
5. Click Decimal, type 60000, and then click OK.

This value represents the time in milliseconds before a service times out.

6. Restart the computer.

Check active queries in MS SQL


Here is an custom query for checking all running queries on an MS SQL server.

the custom writing in this script is just that it runs the sp_who two times and makes an diff on CPU time and DiskIO.

idefix_sql

Download the file under, and run it in MS SQL Server Managmenet Studio.

sp_who2

Usefull PowerShell commands


PowerShell is a powerfull tool when administrating Microsoft products and personally i like using Windows PowerShell ISE that is an powershell tool provided from Microsoft.
It can be found on Windows 8, Windows Server 2012, Windows Server 2008 R2 and Windows Server 2008.

Here are som usefull PS one-liners that i use often 🙂

# Connect to remote server
Enter-PSSession “yourdomaincontroller”

# Disconnect remote session
exit-pssession

# Import the ActiveDirectory cmdlets
Import-Module ActiveDirectory

# List available snapins on your system
Get-PSSnapin

# Add snapins examples
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin # Exchange 2007
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 # Exchange 2010
Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager # WMM (Hyper-V)
Add-PSSnapin Quest.Activeroles.ADManagement # Quest commandlets

# List registered snapins
Get-PSSnapin -Registered

# List Active Directory Computers that have never logged in within time span (-TimeSpan 365.00:00:00, this is 365 days), first line counts the result, second line shows the result, line three sends output to an txt file.
(Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 35.00:00:00 | select name | sort-object name).count
Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 90.00:00:00 | select name | sort-object name
Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 65.00:00:00 | select name | sort-object name | out-file c:\temp\computers.txt

# The following example demonstrates how to find user accounts that have been inactive for 90 days:
Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 | where {$_.ObjectClass -eq ‘user’} | FT Name,ObjectClass –A

# The following example demonstrates how to find inactive user accounts
Search-ADAccount -AccountInactive | where {$_.ObjectClass -eq ‘user’} | FT Name,ObjectClass –A

# The following example demonstrates how to find user accounts that have been inactive since 01/01/2013
Search-ADAccount -AccountInactive -DateTime 01/04/2013 | where {$_.ObjectClass -eq ‘user’} | FT Name,ObjectClass –A

# The following example demonstrates how to find locked-out users in your domain
Search-ADAccount -LockedOut | where {$_.ObjectClass -eq ‘user’} | FT Name,ObjectClass -A

#The following example demonstrates how to unlock the user account U1 in the organizational unit (OU) Test in your domain.
Unlock-ADAccount -Identity “CN=U1,OU=Test,DC=FABRIKAM,DC=COM”

# The following example demonstrates how to unlock the user account U1 in your domain.
Unlock-ADAccount -Identity U1

# Reset pasword on spesific user where “bob” is changed to the username of the user you want to change password on
Set-ADAccountPassword -Identity bob -Reset

PXE boot for some computers doesn’t work, SCCM 2012


Sometimes computers won`t PXE boot for some reason when you are re-installing the Operating system using System Center Configuration Manager.
There can be several reasons for that, most common reason is that the computer object still are located in the SCCM database.

Here are some tips for how to remove obsolete objects:

  1. Search for compuetername in “All systems” found under; “Assets and compliance ->Devices”  and delete the computer from the list
  2. Search for MAC addresses using an report called: “MAC – computers for a specific mac address” found under “Monitoring -> Reporting -> Reports”
  3. Check the SMSPXE.log stored under: /Program files/SMS_CCM/Logs, find the entry where the computer tries to PXE boot and take a note of the “Resource ID” and search for the Resource ID on “All systems” found under; “Assets and compliance -> Devices”, you may need to add “Resource ID” column before searching.

Start with tips one, two and then three, number one and two can save you some time 🙂

The pictures under is for tips three:
SCCM_idefix

SCCM_idefix2

How to find your FSMO Roles?


There are several ways to find out who has your FSMO roles in your Active Directory environment, but the easyest way is to run this:

“NetDOM /query FSMO”

Run the command from CMD or PowerShell.

If you want to user more time to find the FSMO roles use this guides 🙂

http://blogs.technet.com/b/mempson/archive/2007/11/08/how-to-find-out-who-has-your-fsmo-roles.aspx

Tags: ,
%d bloggers like this: