Blog


Manage FSMO Roles with Powershell

Posted by on 9:16 pm in SysAdmin, Windows, Windows Systems Development | Comments Off on Manage FSMO Roles with Powershell

Manage FSMO Roles with Powershell

To transfer all 5 of the FSMO roles simply run the following command in PowerShell: Move-ADDirectoryServerOperationMasterRole -Identity “DC_HOSTNAME” –OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster To shorten the command line syntax you can use role numbers in place of the role names.  The following list details the role number for each of the five FSMO roles. PDC Emulator – 0 RID Master – 1 Infrastructure Master – 2 Schema Master – 3 Domain Naming Master – 4 Using numbers instead you would run the following command in PowerShell: Move-ADDirectoryServerOperationMasterRole -Identity “DC_HOSTNAME” –OperationMasterRole 0,1,2,3,4 Now in my case since the DC was gone permanently I had to seize the roles using the –Force parameter.  This is the PowerShell command I ran to seize the roles: Move-ADDirectoryServerOperationMasterRole -Identity “DC_HOSTNAME” –OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster -Force Using numbers instead you would run the following : Move-ADDirectoryServerOperationMasterRole -Identity “DC_HOSTNAME” –OperationMasterRole 0,1,2,3,4...

read more

List FSMO Roles

Posted by on 9:14 pm in SysAdmin, Windows, Windows Systems Development | Comments Off on List FSMO Roles

List FSMO Roles

This tip explains several ways to check FSMO Roles availability in an Active Directory Forest environment.   To get the list of FSMO Roles using NetDom command line tool, run the following command: Netdom Query FSMO And using DSQuery tools DSQuery server –hasfsmo –pdc DSQuery server –hasfsmo –infr DSQuery server –hasfsmo –rid DSQuery server –hasfsmo –name DSQuery server –hasfsmo –schema DSQuery command returns the FSMO holder name but in the DN format. The DN format looks like below:...

read more

Offline Mssql 2014, 2012, 2008, 2005 Database

Posted by on 5:09 pm in MSSQL, SysAdmin, Windows | Comments Off on Offline Mssql 2014, 2012, 2008, 2005 Database

Offline Mssql 2014, 2012, 2008, 2005 Database

Offline database and gracefully close connections : ALTER DATABASE "DATABASE_NAME" SET OFFLINE 12 ALTER DATABASE "DATABASE_NAME"SET OFFLINE   Offline database and close all connections immediately : ALTER DATABASE "DATABASE_NAME" SET OFFLINE WITH ROLLBACK IMMEDIATE 12 ALTER DATABASE "DATABASE_NAME"SET OFFLINE WITH ROLLBACK IMMEDIATE...

read more

Download Web Page Using Powershell and Scheduled Task

Posted by on 12:24 am in Powershell, SysAdmin, Technology, Windows, Windows Systems Development | 0 comments

To download a web page using powershell and a scheduled task you must do the following : 1. Open Task Scheduler 2. Right click where your existing Tasks are and click Create a new task 3. Give it a name, and description 4. By default the job will run as whatever user you’re logged in as.  If you don’t want this click the “Change User or Group” button to select the user you’d like the job to run as. 5. Select whether you want the Task to run while you’re logged out or not. 6.  Select the triggers tab 7.  Click New and select how frequently you’d like this Task to run than click ok when done. 8. Select the actions tab 9. Click New 10. Be sure “Start a program” is selected for Action 11. Be sure that Program/Script field has “powershell” 12. Be sure that Add Arguments (optional) field has the following replacing www.google.com with the web page you’d like to download. -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"http://www.google.com\")" 1 -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"http://www.google.com\")" 13.  Click ok. Here’s what the actions tab should look like when filled out : 14.  Verify that the conditions and settings tab are the way you’d like than click ok to finish.   This has been tested to work on Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012...

read more

Managing schduled tasks remotely in Windows Server 2012

Posted by on 4:42 pm in SysAdmin, Technology, Windows | 0 comments

I’ve been working with the Task Scheduler Managed Wrapper project on code plex.  While I’ve found this project extremely useful I hit a couple of snags that I figured I’d outline here to help you make use of this library as quickly as possible. 1. Allow scheduled task user to “Log on as a batch job” – When you create a scheduled task you usually run as the user who created the task, or set to run as a user you’ve already created. – Because of this you need to make sure that the node/server/computer where the scheduled task was created has the user the scheduled task is set to run as set as an allowed user to “Log on as a batch job” in your Local Security Policy MMC.   2. Allow “Remote Scheduled Tasks Management” in Windows Firewall – Be sure to log on to the computer where the scheduled task is and allow Remote Scheduled Tasks Management.  Without doing this you will received errors such as the following : System.AppDomainUnloadedException: Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014) at System.StubHelpers.StubHelpers.InternalGetCOMHRExceptionObject(Int32 hr, IntPtr pCPCMD, Object pThis, Boolean fForWinRT) at System.StubHelpers.StubHelpers.GetCOMHRExceptionObject(Int32 hr, IntPtr pCPCMD, Object pThis) at Microsoft.Win32.TaskScheduler.V2Interop.TaskSchedulerClass.Connect(Object serverName, Object user, Object domain, Object password) at Microsoft.Win32.TaskScheduler.TaskService.Connect() at ServerCheck.default2.Page_Load(Object sender, EventArgs e) 1 System.AppDomainUnloadedException: Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014) at System.StubHelpers.StubHelpers.InternalGetCOMHRExceptionObject(Int32 hr, IntPtr pCPCMD, Object pThis, Boolean fForWinRT) at System.StubHelpers.StubHelpers.GetCOMHRExceptionObject(Int32 hr, IntPtr pCPCMD, Object pThis) at Microsoft.Win32.TaskScheduler.V2Interop.TaskSchedulerClass.Connect(Object serverName, Object user, Object domain, Object password) at Microsoft.Win32.TaskScheduler.TaskService.Connect() at ServerCheck.default2.Page_Load(Object sender, EventArgs e) or System.Runtime.InteropServices.COMException (0x80070032): The request is not supported. (Exception from HRESULT: 0x80070032) at Microsoft.Win32.TaskScheduler.V2Interop.TaskSchedulerClass.Connect(Object serverName, Object user, Object domain, Object password) at Microsoft.Win32.TaskScheduler.TaskService.Connect() 1 System.Runtime.InteropServices.COMException (0x80070032): The request is not supported. (Exception from HRESULT: 0x80070032) at Microsoft.Win32.TaskScheduler.V2Interop.TaskSchedulerClass.Connect(Object serverName, Object user, Object domain, Object password) at Microsoft.Win32.TaskScheduler.TaskService.Connect() – Here’s an image of what you should be modifying in Windows Firewall Allowed Apps :...

read more

Can’t Open More Than 6 Windows Server 2012 Tabs mRemoteNG 1.72

Posted by on 9:47 pm in SysAdmin, Technology, Windows | 2 comments

Are you running mRemoteNG and noticed that you can’t open more than 6 Windows Server 2012 Tabs?  Apparently there is a known issue with mRemoteNG not being Large Address aware.  To fix this you’ll need Visual Studio installed on your local computer where you’re running mRemoteNG and perform the following steps.   1.  In Windows Explorer navigate to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts 2. Right click the shortcut named “Developer Command Prompt for VS2013” and run as an Administrator.  If you don’t run as administrator you will receive an error saying “LINK : fatal error LINK1104: cannot open file ‘mRemoteNG.exe'”. 3.  At the command prompt you’ll need to change directories to where mRemoteNG is installed which is usually “C:\Program Files (x86)\mRemoteNG” 4. Be sure you’ve entered the following at the Developer Command Prompt : “cd C:\Program Files (x86)\mRemoteNG” 5.  Then enter the following at the Developer Command Prompt : “editbin /LARGEADDRESSAWARE mRemoteNG.exe”   Thanks for Dafrog @ mRemoteNG’s project tracker for finding the bug and fix : https://mremoteng.atlassian.net/browse/MR-582...

read more

Rackspace Windows Server 2012 R2

Posted by on 1:36 pm in Rackspace, Windows, Windows Systems Development, Windows Web Development | 2 comments

Rackspace has deployed Server 2012 R2 Images.  If you’re looking to use a newer version of Web Deploy or perhaps you’d like to take advantage of  paged out local worker processes to disk instead of memory, than this release is for you! I’ll report back with a review of how my install process went....

read more

SQL Server Find the Size of Log File

Posted by on 9:36 am in MSSQL | 0 comments

I needed to obtain the size of a log file and found this article from SqlAuthority however I still needed something a little more useful.  So used the following tsql :   select size from sys.database_files where type_desc = 'LOG' and type = 1   If you’d like to convert this to megabytes you can use the following tsql :   select SUM(DATALENGTH(size)) / 1048576.0 Size_MBs from sys.database_files where type_desc = 'LOG' and type = 1   Feel free to view this Microsoft article which explains what the columns values are used for within...

read more

Enable Perfmon Counters MSSQL

Posted by on 6:38 pm in MSSQL | 0 comments

Are you wondering why your MSSQL Perform Counters aren’t working? It’s probably because they havn’t been enabled. Simply execute the exctrlst.exe within the Resource Kit directory of your MSSQL Installation Media and select your instance and then check the enable box.

read more

Setup Wireless Bridge Using DD-WRT

Posted by on 9:53 pm in SysAdmin, Technology | 0 comments

I personally found all of these instructions confusing, so I’ve compiled an exact list of what I did to get the “Client Bridge” working with the “V23 SP1” version of the firmware. Instructions update for V24: DHCP does not work between the DHCP server in the “main” AP and the DHCP clients in computers connected to the secondary “client-bridged” WRT54G in this configuration with V24. You will have to assign static IP addresses like 192.168.1.10x to the computers connected to the “client-bridged” WRT54G, a different one for each computer of course. Then it works fine. Annoying! My motivation: I wanted to get my XBox online (and on-LAN) from another room, without running Ethernet to it. WDS was out of the question unfortunately because one of my routers was a late-model WRT54G and as such wasn’t (at the time) easily modified. I had an extra WRT54G lying around that could run DD-WRT. Alternatively I could have bought a proper Linksys or Microsoft solution to connect the XBox to the existing WiFi, but what’s the fun in that? My network is as such: Primary Router (Internet Connection): WRT54G V5 — stock Linksys firmware — 192.168.1.1 Secondary Router (For the Bridge): WRT54G V3 — DD-WRT V23 SP1 Firmware — 192.168.1.1 — which I changed to 192.168.1.2 in my setup (I’m guessing that the Primary Router could be any make and model of wireless router as we’re not doing anything to it!) Slambert71 adds: I set this up today using a Linksys WRT54G V.3 with DD-WRT V23 SP2 firmware as the secondary, and a D-Link DI-624 with factory firmware as the primary and it works great. My Primary Router has 128bit WEP Encryption enabled. It does NOT have Wireless MAC Address Filtering enabled. We will assume you want your Secondary Router to become 192.168.1.2. Mailmanx adds: It worked successful for me with 2 WRT54GL Routers (Router with original firmware, Client Bridge with DD-WRT v23 SP2). WPA-PSK with AES enabled AND MAC Address Filtering (Be sure to set the the correct MAC address! The router provides a LAN, WAN and the needed Wireless MAC address of the Bridge). The MAC addresse can be found on the Status->Sysinfo tab of the DD-WRT webinterface. Jerrytown adds (Sept. 28, 2008): I followed all the steps below and DHCP and DNS did not work. When I installed v23 SP2 (which is quite old at this writing) on the secondary router everything worked fine. Primary: WRT-54G2, Secondary: WRT-54GL. I have my Secondary Router in another room, connected only to my laptop via an Ethernet cable to Port 1. The laptop has an IP from the Secondary Router’s DHCP to begin with. Neither the laptop nor the Secondary Router are connected to anything but each other. I will be doing all of my setup from this laptop. If you have problems with DHCP or losing your IP address in the midst of these instructions, you may need to statically assign an IP to your Ethernet card. (I was running Knoppix Linux on the laptop and I didn’t have to do that, but YMMV!) Setup Log into the Secondary Router. (We will only be altering the Secondary Router!) Administration Tab — Factory Defaults Subtab Restore Factory Defaults: Yes Click “Save Settings” — triggers reboot. (DaveK – I’m using V24 with a Buffalo WHR-G125 router and had to click “Apply” after “Save” in order to trigger...

read more