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 winpop changepwd 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.

Error 0x80004005 accessing CIFS from Windows server 2012

25.Oct.2013 | by Gusac | Filed in: Articles

Issue: Accessing shares hosted on third party file server (like NetApp or EMC) from Windows server 2012 returns error Windows cannot access \\ServerName Check the spelling of the name. Otherwise, there might be a problem with your network. To try to identify and resolve network problems, click Diagnose. Error code: 0x80004005 Unspecified error   Cause: With Windows server 2012 and Windows 8, Secure dialect negotiation is introduced in SMB 3.0. This feature depends upon the correct signing of error responses by all SMBv2 servers, including servers that support only protocol versions 2.0 and 2.1. Some third-party file servers do not return a signed error response. Therefore, the connection fails. Resolution: Method 1: Configure the following registry value on Windows server 2012 Key: “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters” Value Name: RequireSecureNegotiate Value Type: DWORD Value Data: 0 Method 2: Or, Run the Powershell command Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters” RequireSecureNegotiate -Value 0 –Force Method 3: Run the Powershell cmdlet: Set-SmbClientConfiguration – RequireSecureNegotiate 0 Or, you can enable the feature on the third party file server.

List Group Policy Object using PowerShell

4.Jul.2013 | by Gusac | Filed in: Articles

Note: The cmdlet Get-GPO is available on Windows server 2012 and later but can query previous version of AD services.    The cmdlet Get-GPO in Windows server 2012 has the follwoing available parameters you can use: Get a GPO by name The following command will return the GPO with name Second-Test-Policy. Specify the GPO name that you would like to list. Get-GPO -Name 'Second-Test-Policy' Get a GPO by GUID To list a Group policy object by a GUID. Please note, the Guid is not enclosed between braces or ‘squiggly brackets’: ‘{‘ ‘}’ Get-GPO -Guid 17BAE363-6AB5-40BE-A6F9-988EA53B527B   List all GPOs in domain: Get-GPO –All     Get all GPOs from a specific domain or domain controller Get-GPO -All -Domain -Server   The parameters –Domain and –Server are optional. -Domain : Specifies the domain for this cmdlet. -Server : Specifies the name of the domain controller that this cmdlet contacts to complete the operation.   Search GPO with keywords The below command look for the GPO where display name contains the string Test. Get-GPO -All | where{$_.DisplayName -like '*Test*'}ORGet-GPO -All | where{$_.DisplayName -like '*Test*'} | Select DisplayName, GPOStatus

Fix: “C:\Windows\System32\Config\SystemProfile\Desktop” refers to a location that is unavailable.

13.Jun.2013 | by Gusac | Filed in: Articles

Issue: While logging to the server or opening My Computer the system throws error message with description: Title: Location is not available Description: C:\Windows\system32\config\systemprofile\Desktop refers to a location that is unavailable. It could be on a hard drive on this computer, or on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might h ave been moved to a different location. Suggestions: 1. Open Windows Explorer and navigate to: C:\Windows\system32\config\systemprofile and verify if it has the Desktop folder there. 2. If the Desktop folder does not exist, then create an new folder and rename it to Desktop or copy it from C:\users\Default\Desktop location. Note: C:\Users\Default is hidden by default.