Skip to main content

Posts

Showing posts with the label Active Directory

Get accounts in O365 with no ATP or Defender license assigned

Advance Threat Protection aka ATP which is now called Microsoft Defender in office 365, is one of the licenses offered by Microsoft. If there are hundred accounts in O365, tracking which account that doesn't have ATP or Microsoft Defender license is just troublesome. Of course, PowerShell will come into rescue for this kind of issue. One liner code below in PowerShell will check which Office 365 accounts does not have ATP or Microsoft Defender license assigned. Get-MsolUser -All | Where-Object {$_.licenses.AccountSkuId -notcontains 'contoso:ATP_ENTERPRISE'} | Select-Object userprincipalname,licenses | export-csv c:\temp\office_365\no_defender_license.csv Replace contoso with your domain. Or run this command to see which licenses are assigned or available in your tenant. Get-MsolAccountSku | select -ExpandProperty ServiceStatus The PowerShell command checks which accounts does not have ATP assigned; which means that if you have 100 of guests or client user...

What application is running behind svchost.exe in Windows?

Task Manager can be opened in different ways via Taskbar, pressing Ctrl + Shift + Esc or right clicking on the Windows icon and selecting Task Manager. In Task Manager window, it will show what are the processes or services running on the system. On the Details Tab of the Task Manager the details of the .exe file or the applications or services running on the system will be displayed. One noticeable thing on Task Manager is the svchost.exe, depending on how busy the system is or how many applications, browsers or other items that will need to connect to svchost.exe. The said exe file can easily be seen on Task Manager since there will be few of them.   But what is the application running behind the svchost.exe? Or what is occupying or using svchost.exe? Why there are a few of them running on the system? To get to the bottom of all the questions above, PID or Process ID will show what is behind the svchost.exe. To do this, open an elevated CMD or command prompt window....

Windows CLI get CPU Name, IP, OS, Mem and computer Name

One of the task of a Windows Admin is to know what OSes are running on his or her environment. Aside from checking what type of OSes are running, making sure also that CPU and Memory on users computers are suitable enough, so users can be productive. If the user doesn't have enough resources to run any software to do users tasks won't be  productive at all since and may end up consuming a lot of coffee than doing their work. :) So, as an IT Admin checking all these things will help to have a smooth operations. IP Address is the communication link of the device to the router, and the IP Address also links to the hostname or computer name and will be ultimately linked also to the logged in user. Example, deploying a specific software to a single user. IP Address must be known  in advanced or else the software being deployed might end up in someone else computer and can be disastrous if the license will be tied automatically to the hostname or IP Address.  WMIC command below...

Windows share files between user profiles or user accounts

Newer windows such as Windows 7, windows 8 and windows 10 has the feature to share files between user profiles or user accounts. This feature is useful when the computer is shared between user accounts or the computer is shared and has multiple user accounts. This would also be ideal, if you created a new user account and wants to transfer or copy the files from the old account to the new account. Of course, there are a lot of ways on how to move or copy files. Like copying to external drive, uploading to cloud such as Google Drive, OneDrive, Dropbox or other applications. Such options require a 3 rd party application, but Windows provides a user profile that whatever files or folder that is placed on this account is accessible to all user accounts in the computer. So, how to share file or folder in Windows to other user accounts without changing permissions? %public%\desktop   - - - files or folders on here will be shared to all user account desktop %public%\docum...

Difference between incremental and differential backup

Differential or Incremental backup are part of the options that need to be selected when installing a backup software. Or the system admin has to choose which backup strategy he or she will adapt. Backup is very important so you have something to rely on when disaster strikes. So, what’s the difference between differential and incremental backup? Which one is better? Differential backup – contains  the files that have changed since the last full backup. So, if the full backup was Sunday, Monday will have files that changed since  Sunday  backup. For the differential backup of Tuesday, it will contain the files of Monday and the files of Tuesday. Differential backup = requires large space since every differential backup has the files that had changed since the last full backup Incremental backup – backup only the changed data since the last backup. So, if the Full backup was done on Sunday; Monday backup will only have the data that has changed since last Sunday ...

Monitor disk drive space using PowerShell

Monitoring space is quite crucial in a critical system, or basically checking the disk space whether there is enough free space for continual operation is a good thing to consider in a production environment. A simple PowerShell script can save the day by monitoring the drive space of a specific drive that needs to be checked or monitored. It doesn’t need a complex tool to do this kind of task. Here’s a one-liner PowerShell script to check free space on C drive. Get-WmiObject Win32_LogicalDisk -filter "DeviceID = 'c:' " | Select-Object   { $_ . FreeSpace / 1GB }   "DeviceID = 'c:' " = this can be changed to any drive letter Output of the above command: $_.FreeSpace /1GB -----------------   293.042289733887   Or to include the existing size of the drive, the command can be tweaked like this: Get-WmiObject Win32_LogicalDisk -filter "DeviceID = 'c:' " | Select-Object   { $_ . FreeSpace / 1GB } , { $...

PowerShell switch case call function

Code below collect user input and uses switch case statement to check if the input matches, and if it matches a function is called that will execute commands. Here’s the code: #get or read from user input $computer_name = read-host ( "Enter Computer Name:" )   switch ( $computer_name )   {     #if the input is computer_1 then function func_comuputer1 is called   computer_1     { func_computer1 }     computer_2     { func_computer2 }   }     #function called if computer_1 is the input function func_computer1 {   write-host "You entered Computer_1" #or replaced with other function like reboot / shutdown /or other commands #Restart-Computer -ComputerName computer_1   }   #function called if computer_2 is the input function func_computer2 {   write-host "You entered Computer_2" #or replaced with other function like reboot / shutdown /or other c...

Create a new text file with content in Linux

Touch command in Linux will create an empty file in Linux command line. If no other parameters is specified whether a line will be inserted to the newly created file. Cat command is for reading files via command line but it can also be used to create a file in Linux terminal window command line. Cat command below will create a file called “test_comment.txt” and with the content or the line of “Hello World of Touch and Create File” on the file created. Here’s the shell command: cat  <( echo “Hello World of Touch and Create File”)  >  test_comment.txt Note that there is no space between “<(“, if there is a space then the command will not work as expected. Touch command to create a new file and also insert a new line or insert a string on the newly created file. Here’s the shell command: touch touch_file_comment.txt; echo “Hello World of Touch, insert this line.” >  touch_file_comment.txt Basically, the command exec...

PowerShell check access or folder permissions

In an Active Directory domain, one of the common issues is folder permissions. Of course, permission must be restricted as much as possible. In order, confidential data or things that only a group of people will know, is not made available to everyone. Employee salaries on a network share made available to everyone, will cause some employees to be disheartened. Such data, the access or folder permission should be checked properly. One way to check a folder permission is to assume or login as a certain user that is not supposed to have access to such data and checked whether the data can be viewed or not. Aside from restricting permissions for confidential data; data supposed to be accessed by everyone but some user’s complaint that they are unable to access then this will also cause some problem and may end up not being productive for the users. One way to check is to go to the user’s workstation and verify whether the user is unable to access. This kind of issue is...