Home Articles | Tutorials | Troubleshooting | Tweaks | Windows Server 2012 | Subsribe to RSS Feed Subscribe to RSS Affiliated sites

Follow me  Follow gusac on Twitter  Subscribe  Subscribe to RSS

How to install NetApp PowerShell cmdlets

9.Sep.2014 | by Gusac | Filed in: Articles, Tutorials

  1. Download the DataONTAP.zip from NetApp site 2. Extract the content folder DataONTAP. 3. Copy the DataONTAP folder to the following location:  C:\Windows\System32\WindowsPowerShell\v1.0\Modules 4. Launch the PowerShell window and type the following command. Confirm ‘Yes’ when prompted. Set-ExecutionPolicy unrestricted   5. Type another command to import the NetApp DataOntap modules in PowerShell: 6. Its done! You can confirm by running below command. It will list all the NetAPP cmdlets available Get-Command -module DataONTAP

Find file / folder owner information using PowerShell or command prompt

23.Aug.2014 | by Gusac | Filed in: Articles, Tutorials

PowerShell GET-ACL "$Path"| select path, Owner -expand access .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   where “$Path” could be a variable of the folder path or you can replace with the value like “c:\temp”   If you notice, the Path attribute has some unwanted value ‘Microsoft.PowerShell.Core\Filesystem'::’  To further format the output, we can modify the above command as: GET-ACL "$Path"| select path, Owner -expand access | select @{n="Path";e={$_.Path.replace("Microsoft.PowerShell.Core\FileSystem::","")}}, Owner, IdentityReference, FileSystemRights, AccessControlType, IsInherited   Command Prompt DIR command switches have not been explored to the core. The DIR command not only lists all available files and directories in the current directory but also can show the last modification date and time, file size and lot more. All we need to do is run the below command to find the owner of the folder DIR /Q <Folder Path> Add the /S switch to browse through the subdirectories and files Add the /AD switch to list only the directories

Active Directory Schema versions

25.Apr.2014 | by Gusac | Filed in: Articles, Tutorials

You can check Active Directory schema version via different methods defined in the following article:  How to check Active Directory Schema Versions Below is the list of different AD schema versions Windows 200 Server 13 Windows Server 2003 30 Windows Server 2003 R2 31 Window Server 2008 44 Windows Server 2008 R2 47 Windows Server 2012 56 Windows Server 2012 R2 69

Get Serial Number using command line and PowerShell

10.Apr.2014 | by Gusac | Filed in: Articles, Tutorials

System’s serial number information is stored in WMI. The WMI class is Win32_Bios and there are different ways to query it. We are going to discuss two methods: Command Line Open the command prompt and type the following command: wmic bios get serialnumber     If you want query a remote system, add the switch /NODE:SERVERNAME, where SERVERNAME is the name of the remote system you want to query.   wmic /node:RemoteSVR01 bios get serialnumber   In above example, the command queries the remote system with name ‘RemoteSvr01’. PowerShell For local system:   Get-WmiObject -Class Win32_Bios   To query a remote system named ‘RemoteSvr01’: Get-WmiObject -Class Win32_Bios -ComputerName RemoteSvr01

Get DHCP Scopes using PowerShell

7.Apr.2014 | by Gusac | Filed in: Articles

We need DHCP PowerShell cmdlet to be available in order to manage DHCP. By default, the DHCP module is not loaded in PowerShell. We need to install and the import the DHCP module before we can use it. Importing DHCP Powershell cmdlet If you’re going to use PowerShell on the DHCP server, then ensure the Management tools are also installed. Below is the PowerShell command to install DHCP role with management tools Add-WindowsFeature -Name DHCP –IncludeManagementTools If you’re going to manage the server remotely, then you can install RSAT tool – features Add-WindowsFeature RSAT-DHCP Once installed, import the DHCP module before you can use. Import-Module DhcpServer List all the authorized DHCP servers in Active Directory Get-DhcpServerInDC Get DHCP scope configuration for one scope Get-DhcpServerv4Scope –ComputerName <DHCPServerName> –ScopeID <ScopeID> Get list of all DHCP scopes on a DHCP server Get-DhcpServerv4Scope –ComputerName <DHCPServerName> If you need to include more settings like Delay,  Description, Name Get-DhcpServerv4Scope –ComputerName <DHCPServerName> | FL *   Get DHCP Server Option Get-DhcpServerv4OptionValue -ComputerName <ServerName>   Get DHCP Scope option Returns all scope options for a specified DHCP scope: Get-DhcpServerv4OptionValue -ComputerName <ServerName> –ScopeID <ScopeID>   Example: Get-DhcpServerv4OptionValue -ComputerName MyDHCPSvr01 -Scope Check one particular scope option for a subnet: Get-DHCPServerv4OptionValue -ComputerName <ServerName> -ScopeID <ScopeID> -OptionID <Option>   Example: Get-DhcpServerv4OptionValue –ComputerName MyDHCPSvr01 –ScopeID –OptionID 66

Delegating Group Policy Modeling Permission

23.Mar.2014 | by Gusac | Filed in: Articles

Delegate Permissions 1. Open Group Policy Management Console (GPMC), navigate to the OU you want to delegate permissions for Group Policy Modeling. 2. In the results pane on the right, click on the Delegation tab. 3. In Permission drop down list, select Perform Group Policy Modeling Analyses 4. Click the Add button at the bottom. It would bring the up the Select User, Computer, or Group window. 5. Enter the name of the object to which you want to delegate permissions and click OK 6. In the Add Group or User dialog box, select the Permission level and click OK   COM Permissions In some cases, user still get error message:  Group Policy Modeling Wizard: "Access is denied" . This is because of the COM Permissions. 1. On the domain controller, you’re connecting to, Open Component Services. Start – Run – type DCOMCNFG and hit Enter. 2. Expand Component Services –> Computers –> My Computer 3. Right click on My Computer and choose Properties 4. On the COM Security tab, click Edit Limits in the Launch and Activation Permissions field. 5. Click the user name in the Group or user names field that you want to be able to run the Group Policy Modeling Wizard, and then click to select Allow for the Remote Activation permission. 6. Click OK two times. Group Policy - Same setting can be implement via group policy if there are multiple Domain controllers. Group Policy Setting: – Computer Configuration – Windows Settings – Security Settings – Local Policies – Security Options - [DCOM: Machine launch restrictions in Security Descriptor Definition Language (SDDL) syntax. Edit the setting and add the required AD account and click Allow.

Error installing .Net framework on Windows server 2012 R2

2.Mar.2014 | by Gusac | Filed in: Articles

Issue: While installed .Net Framework from Server Manager – Add/Remove Features page, the installation fails with the following error: “One or more installation selections are missing source files on the destination server. ” If you click on the Install button, the installation will fail with the message: “The source files could not be found.”  It suggests to click “Specify an alternate source path” to specify a valid location of the source files that are required for the installation.   Solution: Method 1:  Run the following command in elevated command prompt. Replace the <drive> with the actual drive letter of the installation media: Dism /online /enable-feature /featurename:NetFx3 /All /Source:<drive>:\sources\sxs /LimitAccess Method 2: The solution is provide the source path of the setup. On the ‘Confirm installation selections’ page, click on the “Specify an alternate source path” option given at the bottom. Specify the Windows setup path: Could be the installation media or setup files copied on disk. Specify the Root\Sources\SXS folder as shown below. Setup should be able to pick up files now.

Reset Pop3 user account password on Windows Pop3 server

15.Jan.2014 | by Gusac | Filed in: Articles

Below command shows how to reset a password for users POP3 account on Windows server using command line. winpop changepwd USER@DOMAIN NewPassword .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Example: Below command resets the password to Sunday1! for user GS in domain Winplat.net winpop changepwd gs@winplat.net Sunday1! .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

DNS Server service failure: The interface is unknown

23.Dec.2013 | by Gusac | Filed in: Troubleshoot, Articles

DNS server service on Windows 2008 R2 server failed to start with error: Windows could not start the DNS Server service on Local Computer. Error 1717: The interface is unknown.   Resolution: Upon investigation, I found that the Windows Event log service was also not started. Attempt to start the service would fail with error Access is Denied. So, I used Process Monitor (Procmon.exe), ran it and reproduced the issue with Windows event log service again. The Local Service account did not have Write privilege on folder C:\Windows\System32\winevt\Logs Granted Local Service account Write privilege on the above mentioned folder. Started the Event log service successfully and started the DNS service successfully. Below is the screenshot of ProcMon output with filter to display result containing Access denied

Clear all print jobs using PowerShell

27.Oct.2013 | by Gusac | Filed in: Articles, Tutorials

Note: Cmdlet is available on Windows server 2012 but works remotely for previous versions. Windows Server 2012 has a new cmdlet Remove-PrintJob that helps delete the print jobs on the server. You need to specify either the Job ID or the Printer name. Example: Remove-PrintJob -ComputerName tctp22wspsx01 -PrinterName <TestPrinter> -ID 2 Clear all print jobs on the server The command below removes all the print jobs on remote computer. Get-Printer -ComputerName <SystemName>| Get-PrintJob | Remove-PrintJob or Removes all print jobs on the local system. Get-Printer | Get-PrintJob | Remove-PrintJob The above commands gets the list of printers on the system, pass it on the to next cmdlet which retrieves the print jobs on each of the printer. These jobs are then passed on to next cmdlet which finally removes the passed print jobs on the specified computer. Clear all print jobs older than X days Below example delete all print jobs older than 1 day: Get-Printer -ComputerName PrintServer1 | get-printjob | where{$_.SubmittedTime -lt ((Get-Date).adddays(-1))} | Remove-PrintJob (Get-Date).AddDays(-1)  - Change the value –1 to increase the number of days.