Showing posts with label Troubleshooting. Show all posts
Showing posts with label Troubleshooting. Show all posts

Tuesday, 16 November 2021

How to reclaim space from deleted files on windows server deduplication volume

Windows server has great deduplication functionality allowing for increased usable capacity on non-operating system volumes, by performing block level deduplication to increase storage efficiency. This is particularly useful for storing data such as backups, which often involves minimal changing data, so a prime candidate for effective deduplication.

The problem often encountered with deduplication volumes is that when files are deleted, the space is not immediately reclaimed by the operating system. A "garbage collection" process needs to be run in order for the deduplication engine to reclaim this space.

Thankfully, this is incredibly easy to do and can be done from a powershell command prompt - here's the command you need to run;

start-dedupjob -type GarbageCollection -full -path e: -FastStart $true

Be sure to change the -path variable from E: to whatever drive you wish to run the garbage collection on. Also note that depending on the size of your volume, the garbage collection can take some time to initiate and complete, even with using the -FastStart switch.

You can check the progress of your deduplication jobs by running the command

get-dedupjob

Tuesday, 17 August 2021

Install Active Directory Powershell Module in Windows 10

For whatever reason, Microsoft has now changed the way the powershell module for Active Directory Domain Services and Lightweight Directory Services tools.

Most documentation suggests you install this from the "Turn Windows features on or off" menu located under Programs and Features within Control Panel - but in later Windows 10 releases, the feature is no longer available. It was previously called "Role Administration Tools".

Role Administration Tools is no longer visible under Turn Windows Features on or off

Likewise, the previously used powershell command is no longer recognised

Enable-WindowsOptionalFeature -Online -FeatureName RSATClient-Roles-AD-Powershell

You now get an error when running this command

Enable-WindowsOptionalFeature : Feature name RSATClient-Roles-AD-Powershell is unknown.

So, how do you do it? Follow the steps below
  1. Click the Start button then select Settings
  2. Select Apps
  3. Select Optional Features
  4. Click Add a Feature
  5. Search for "RSAT" and select the option for RSAT: Active Directory Domain Services and Lightweight Directory Services Tools. 



    Select the option for RSAT: Active Directory Domain Services and Lightweight Directory Services

  6. Click Install
If you get an error saying the install failed, make sure you aren't using a WSUS server as windows will try and install it from there by default if you are.

To check, open regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU and set the UseWUServer key to 0


Tuesday, 10 August 2021

Microsoft Teams - Get Team ID/Group ID using Powershell

Many Microsoft Teams commands for powershell require you to specify the group id for a team so the script knows which one of your teams you wish to work on. The Group ID/Team ID is a unique string of letters and numbers which is why it's commonly used to ensure only one team would ever be targeted by a command.

Use the command(s) below to get the group id for one, or all of your teams.

Connect-MicrosoftTeams

get-team -displayname "Test Class"

You should get a response with the GroupID shown like in the example below;


Simple, right? What if I wanted to get the properties for all of my teams? Try the command below

get-team

You can even store the groupid in a variable so it's easier to reference in subsequent commands. In this example, we'll store the properties in the $teamprops variable;

$teamprops = get-team -displayname "Test Class"

You can then use the $teamprops.groupid property in another command - for example;

add-teamuser -groupid $teamprops.groupid -user "user@domain.com"

Monday, 9 August 2021

Microsoft Teams - Add Members to Private Channel using Powershell

If you have a large number of members you need to add to a private channel in teams, you may wish to use powershell to do so as it can be much faster than manually adding users via the Teams app, or web management interface.

Note that you will need to install the preview/prerelease version of the Microsoft Teams powershell module to get access to the cmdlet that we're using here (refer to my separate blog post on how to do this)

Add-TeamChannelUser -GroupID "abc123456789" -Displayname "privatechannelname" -user "user@domain.com"

Be sure to update the Group ID with the unique Group ID of your target team - and the displayname should match the displayname of the private channel you wish to add the user to.

Note that adding users via this cmdlet can cause them to not show in the actual team for some time (in my experience 15-30 mins) so you may need to allow some time before checking/confirming they appear in the channel user list

Sunday, 8 August 2021

Microsoft Teams - Install Preview/Prerelease Powershell Module

Microsoft Teams has a preview/prerelease version of their powershell module available which has some commands that aren't contained in the general/public release.

If you wish to install the prerelease module, you can use the command below to do so

Install-Module -Name MicrosoftTeams -AllowPrerelease -force

You may need to restart your powershell session and import the module again to get the required cmdlets.

If you get an error saying the 'allowprerelease' argument isn't recognized, then run the below commands ot update the PackageManagement and PowershellGet modules

Install-Module -Name PackageManagement -Repository PSGallery -Force
Install-Module -Name PowerShellGet -Repository PSGallery -Force

Restart your powershell session then run the install-module command again and it should complete successfully.

Saturday, 7 August 2021

Powershell - a parameter cannot be found that matches parameter name 'AllowPrerelease'

Sometimes when installing powershell modules, you may wish to utilise pre-release or preview versions of packages. Depending on what version of powershell you have installed, you may get an error message like the one below when attempting to install preview/prerelease packages;

Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.

At line:1 char:37

To fix the problem you need to force an update of a couple of Powershell modules - namely PowershellGet and PackageManagement. 

Run the commands below from an elevated powershell command prompt;

Install-Module -Name PowerShellGet -Repository PSGallery -Force
Install-Module -Name PackageManagement -Repository PSGallery -Force

Exit/close your Powershell window/session then re-open and run the install-module command again - it should now complete successfully

Friday, 6 August 2021

Microsoft Teams - teamchanneluser cmdlet is not recognized

Microsoft Teams features some commands (cmdlets) that are not readily available in the public/general release version of the Microsoft Teams powershell module. Some of these commands are;

get-teamchanneluser

add-teamchanneluser

If you attempt to run these commands, you'll get an error message like the one below;

get-teamchanneluser : The term 'get-teamchanneluser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

To fix the problem you will need to install the preview release of the Microsoft Teams powershell module. You can check the release version numbers from the website below

https://www.powershellgallery.com/packages/MicrosoftTeams/2.0.0

To install the preview release version, make note of the version number then run the command below

Install-Module -Name MicrosoftTeams -AllowPrerelease

To fix the problem you need to force an update of a couple of Powershell modules - namely PowershellGet and PackageManagement. 

Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.

At line:1 char:37

Run the commands below from an elevanted powershell command prompt;

Install-Module -Name PowerShellGet -Repository PSGallery -Force
Install-Module -Name PackageManagement -Repository PSGallery -Force

Exit/close your Powershell window/session then re-open and run the install-module command again - it should now complete successfully

You can confirm what version is installed by running the commands

import-module "MicrosoftTeams"

get-module

Look for the version number for the "MicrosoftTeams" module

Monday, 24 October 2016

Outlook - Mailbox Full Message after storage quota increased (or removed)

I recently experienced an issue where multiple users for a mailbox were getting a "mailbox full" message in Outlook. When the message first appeared, I removed the storage quota on the mailbox, but after a server restart (and of course restarting the outlook clients), they were still getting prompted with the same message.

The solution ended up being to remove the .ost file for this particular mailbox (default location is %localappdata\Microsoft\Outlook) and then restarting the Outlook client (you will need to close Outlook before it will let you delete the .ost file)

The .ost file will automatically be re-created when Outlook is opened, and mail will then be downloaded back into the .ost file from the server.

Wednesday, 19 October 2016

iPhone - Bottom Half of Screen Disappearing

For quite some time I experienced what I thought was a strange issue on my iPhone where the bottom half of the screen would suddenly disappear, or "scroll" down underneath the viewable area of the screen - just like in the picture below;

Original home screen
Home screen after "Reachabiliy" activated
 




















After a little bit of research, I found out that is actually a feature within the iPhone software known as "reachability". The idea being that the top half of the screen scrolls or moves towards the bottom of the screen, to make items that were originally at the top of screen more accessible when using the device with one hand. Pretty clever, right?

Reachability is activated by double tapping (note: not double pressing) the home button. Ie. tap the home button twice rapidly, but don't actually press the button down so it 'clicks'

Press the home button or tap anywhere on the screen to return the screen to normal

Wednesday, 12 October 2016

Windows - Unable to remove printer driver - The specified printer driver is currently in use

Sometimes you may need to uninstall a printer driver from a computer (because of corruption, to re-install etc), and may get the below error message;

"Unable to remove printername. The specified printer driver is currently in use"



This may even occur AFTER you have removed the printer itself from your list in Devices & Printers.

Here are some steps I found that allowed me to remove the printer and printer driver without having to restart the computer;


  1. Open Devices and Printers
  2. Right click the device you need to remove and select Remove Device
  3. Open Services.msc and locate the Print Spooler service
  4. Right click the Print Spooler service and select Stop
  5. Open regedit
  6. Browse to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\
  7. Depending on whether you are running a 32 or 64 bit windows, expand the key for Windows NT x86 (if you're running 32 bit windows), or Windows x64 (if you are running 64 bit windows)
  8. Expand the Print Processors key
  9. Rename any entries under Print Processors to have .old on the end. In the example below, there is one entry, winprint which I renamed to winprint.old

  10. Go back to services.msc and start the Print Spooler service
  11. Open the Print Server Properties and try to remove the driver pack - it should now remove successfully
  12. Once the driver pack is removed, stop the Print Spooler service again
  13. Go back to regedit and rename the key(s) you renamed to have .old on the end back to their original name(s) - as per my example, winprint.old will be renamed back to winprint
  14. Start the Print Spooler service from services.msc
  15. Re-install printer & drivers as required




Monday, 10 October 2016

iPod/iPhone/iPad not appearing in iTunes

I occasionally experience an issue with my iPod, where after connecting it to my laptop via USB, and having the iPod appear in Windows Explorer, it won't appear as a device in iTunes

iPod showing in Windows Explorer but not iTunes

Follow the steps below to fix the issue;


  1. Close iTunes if you already have it running
  2. Click on the Start button (bottom left corner of screen) and type services.msc and press Enter
  3. A new window will now open showing a list of all windows services. Sort the list by name and locate the Apple Mobile Device Service
  4. Right click on this service and select Restart

  5. Once the service has restarted, locate the iPod Service. Right click on this service and select Restart

  6. Open iTunes. Your iPod/iPhone should now appear within iTunes correctly


Friday, 7 October 2016

Fix Windows Update Error Code 80070003

I got this error code today on a Windows 7 PC after trying to install some windows updates



Code 8007003
Code 643

To fix it, follow the steps below;
  1. Click on the Start button (bottom left corner) and types services.msc and press enter (to open the Services control panel)
  2. Locate the Windows Update service. Right click it and select Stop


  3. Open Windows Explorer. Navigate to the folder C:\Windows\SoftwareDistribution\Download folder. Delete everything within this folder - (this is where the windows updates are downloaded to before being installed)
  4. Go back to your list of services from Step 2. Right click the Windows Update service and select Start
  5. Go back to your windows updates and click Check for updates again and proceed to install them as you normally would




Thursday, 29 September 2016

iPhone/iPad - Cannot send mail. A copy has been placed in your Outbox. The recipient was rejected by the server

Occasionally I've seen users experience an issue where they can no longer send emails to anyone from their iPad or iPhone, they get the below error message;

"Cannot send mail. A copy has been placed in your Outbox. The recipient %name% was rejected by the server"

The issue is usually caused by the authentication (ie. username and password) failing for the email account, because it is either missing or incorrect.

I've often seen this happen after iOS updates, as passwords for email accounts aren't always preserved during the update process. As a result, the password appears to be present (when you check the settings), but actually isn't, and therefore emails won't send any longer.

To fix the issue, do the following on the problematic device(s);


  • Go to Settings
  • Go to Mail

  • Select Accounts

  • Select the account that you are having problems sending from

  • Select the account again (first option at top of screen)

  • Update the Domain, Username and Password fields. Even if the password appears to be in there (represented by black circles), delete whatever is in there and re-type the password

  • Click Done from the top right corner. Settings should now be checked and you should get a list of ticks down the ride side of the page
If the settings saved successfully you can try sending emails again, it should now work correctly.

Tuesday, 27 September 2016

Querying/Checking Windows Event Viewer Logs with Powershell

Powershell has a cmdlet you can use to check/query the windows event log.  You can customize this cmdlet in several ways to refine the information that is returned.

For example, you can use the -after switch to only return event log entries after a certain date - such as events only returned within the past 1 day (24 hours)

You can also filter the type of entries that are returned. An example would be to only return warning or error entries, and ignore any "informational" type entries

Let's start with the basic command;

get-eventlog -logname "Application"

This command will return all entries within the Application log, which will usually be alot, and not very useful. You can also use "System" or "Security" as other default logs.

Let's refine the command further, to only return entries for the past day. To do this we will define the current date into the $date variable, and subtract one day from that value

$date = get-date
$date = $date.adddays(-1)

We can now use this $date variable to return all event log entries AFTER this date (using the -after switch)

get-eventlog -logname "Application" -after $date

The script will now return ALL events from the Application log from the past 24 hours. Let's refine it a bit further and filter the results so only Warning and Errors are returned

get-eventlog -logname "Application" -after $date | where-object {$_.entrytype -ne "Information"}

Of course you can store the results into a variable so it can be further queried using subsequent commands;

$events = get-eventlog -logname "Application" -after $date | where-object {$_.entrytype -ne "Information"}

Tuesday, 20 September 2016

iTunes Artist Icons/Thumbnails Missing

It appears there is a bug (or new feature) in the latest version of iTunes (12.5) and iOS 10 where a majority of artist icons/thumbnails/images for missing when in the Library > Artists view, as per the screenshots below - they only show a generic microphone icon/thumbnail.





I haven't been able to find a setting/option to fix this at the moment. After doing some research I'm certainly not the first person to notice this "bug".

Only "workaround" for the issue currently is to not use the artist view and instead use the "Albums" or "Songs" view which show album artwork correctly and do not utilize artist images.

Let me know in the comments if you've noticed this bug as well, or if you have found a solution. I'll continue searching and will keep this posted updated with any fixes I find.

Update: I've found an apple discussion thread that states that the artist photo only shows up if you've purchased an album from that artist from the Apple Music store.

https://discussions.apple.com/thread/7663488?start=0&tstart=0


Monday, 19 September 2016

iTunes could not connect to the iPhone because an invalid response was received from the device

I encountered this issue on my home PC after getting my new iPhone 7. I had previously sync'd the phone with my laptop, but upon connecting it to my PC, I got the error message;

"iTunes could not connect to the iPhone because an invalid response was received from the device"

I was pretty confident the phone wasn't the issue as it had successfully sync'd with another computer - I tried the following steps first which did not fix the issue;


  • Different USB/lightning cable
  • Different USB port
  • Rebooted computer
  • Rebooted iPhone
  • Ensured iPhone wasn't locked when connecting
  • Removed iPhone device from device manager
What ended up fixing the issue in the end was uninstalling and re-installing iTunes on the computer.

Monday, 12 September 2016

Windows Server - Unable to extend volume - There is not enough space available on the disk(s) to complete this operation

Came across this issue today on a virtual machine running in a VMware environment. After allocating additional hard disk space to the virtual machine (running Windows Server 2012), the following error appeared when attempting to extend the hard disk;



"There is not enough disk space available on the disk(s) to complete this operation"

Even though the space was showing as "unallocated" in disk management, this error still appeared when trying to extend the volume.

The fix - turns out it was quite simple. From within the Disk Management utility, go to Action > Rescan Disks then try running the extend disk again.


Thursday, 8 September 2016

Exchange 2010 New Install - Nothing Showing Under Microsoft Exchange On-Premises

After installing Microsoft Exchange Server 2010 onto a Windows Server 2012 R2, nothing was showing under the Exchange Management Console after expanding "Microsoft Exchange On-Premises".

Everything under "Exchange 2010 Organizational Health" was showing as "Unavailable"



When selecting the option to "Collect Organizational Health Data", the below error occurs stating "MMC has detected an error in a snap-in and will unload it"



To resolve this issue you need to install the latest Service Pack (SP3) for Microsoft Exchange Server 2010 - available from the following URL:

https://www.microsoft.com/en-us/download/details.aspx?id=36768

You can then install Update Rollup 14 for Microsoft Exchange Server 2010 SP3 from the following URL:

http://go.microsoft.com/fwlink/p/?LinkId=820579

As you can see below, once SP3 has been installed, the Configuration options are now available/showing under "Microsoft Exchange On-Premises" after the updates are installed

Monday, 15 August 2016

Cryptolocker & Ransomware Viruses - Information, Recovery & Prevention

One of the biggest bains of today's IT professionals is a relatively new breed of virus called "Cryptolocker". It is a type of ransomware that essentially takes your files hostage by encrypting them (when they are encrypted, your are unable to view or access them). The virus creator then demands payment for the "key" to decrypt these files.

These viruses are incredibly nasty, and it seems that most antivirus applications cannot stop them, or simply cannot keep up with the increasing number of variants of the virus. Given the money that antivirus companies charge for their applications, I'm not sure why they still seem unable to combat them, and find it frustrating that they don't.

So how do you get infected with a cryptolocker/ransomeware virus? In most cases users are tricked into running an application that contains the malicious code that encrypts your files. The application is normally sent as an attachment, or link/URL pointing to the application that is cleverly disguised as something else.

Some of the emails I've seen are from Australia Post, advising of a missed parcel delivery. From AGL sending you a link to your latest "Electricity Bill", or the Australian Federal Police with a link to a supposed speeding fine. Of course the best defense to these sorts of things is vigilance and common sense, and simply not opening these emails. Scrutinise everything is my best tip. There are normally a few things you can check/test if you're unsure about the legitimacy of an email you've received;

1. Emails sent from large companies like Australia Post, or AGL, will have a "From" address that contains their business name (eg. notifications@australiapost.com.au, or billing @agl.com.au). These cryptolocker emails will not have these full email addresses (see example below)



2. As I mentioned, common sense also plays a big part. Were/are you expecting a parcel/delivery from Australia Post? In Australia, speeding fines aren't issued via email, and they certainly aren't issued by the Australian Federal Police. And is AGL even your electricity provider? If you're not sure, you can always call these companies directly to check. A single phone call could save you alot of time, money and heart ache.

3. The emails will often have spelling or grammar mistakes which is a sure sign they are not legitimate.

If you do get infected with one of these encrytion viruses, in my experience it is unlikely (though not impossible) that you'll be able to get your files back, unless you are able to restore from a backup. Chances are by the time you realise you've been infected, all the files on your computer will be encrypted and no longer accessible.

You can quickly tell because the extension of the encrypted files will change to .encryted or .enc. A popup message will usually appear as well advising you that your files have been encrypted, and will provide a link/instructions on how to decrypt your files (via payment to the virus creator). The virus will scan all the files/folders on your computer, as well as any network/shared drives you have access to and encrypt all files it can find.

Decrypting your files
The following link contains some information/applications you can use to check if your encrypt files are recoverable. As previously stated, there are a large number of "variants" of the cryptolocker virus, some of which are able to be "cracked" using a special utility. You will need a copy of an encrypted file, and the unencrypted version of the same file in order for the process to complete. You can upload a sample and locate recovery tools (if available) from the below website:

https://id-ransomware.malwarehunterteam.com/identify.php

You can also follow this next link which has a full, detailed guide on removing cryptolocker, or other ransomware/malware from your computer if you do get infected. (Note that removing the virus/infection will not unencrypt or recover your files.)

https://malwaretips.com/blogs/malware-removal-guide-for-windows/

Backup Strategies
In my next blog post I will be outlining a free and easy way to implement a backup solution on your home laptop/PC. With the low cost of removable storage (eg. USB hard drives), and the increasing amount of personal photos/files stored on computers, a regular computer backup is a must do for all computer users!

Wednesday, 26 March 2014

Working with Windows Services in Powershell

We can use the get-wmiobject method in order to retrieve properties of windows services on local or remote servers.

The query below is an example on how to get the properties of the Print Spooler service on a local machine (ie. the same machine that the script is being executed on)

To get the "Service Name" of a windows service, go to services.msc, select a service, open it's properties (right click > Properties) and look at the "Service Name" at the top. 

$serviceprops = get-wmiobject -class win32_service -filter "name='Spooler'"

If we then run $serviceprops we get the following information;

ExitCode  : 0
Name      : Spooler
ProcessId : 1628
StartMode : Auto
State     : Running

Status    : OK

This information could therefore be used to check the respective windows process ID, start mode, state and status of a service

The query below is an example on how to get the properties of the Print Spooler service on a remote machine (server1)

$serviceprops = get-wmiobject -computername "server1" -class win32_service -filter "name='Spooler'"

As you can see, the command is mostly the same, we have simply added the argument "-computername "server1"" to make the get-wmiobject query run on the remote server.

We can then take this one step further and perform an action (aka method) on a service, such as starting or stopping it. To view the available methods for the service, run a get-member on the $serviceprops variable;

$serviceprops | get-member

You will then see a list of available methods (and properties) for the variable.

Two of the most common methods for a service would be to start or stop the service. We simply append the respective methods onto the end of the $serviceprops variable (after it has run the get-wmiobject query above to get the service properties).

To start a service;
$serviceprops.startservice()

To stop a service;
$serviceprops.stopservice()