Sunday, April 9, 2017

PowerShell Basics : Find commands by using Get-Command cmdlet.

 

Sometimes, the more we do advance things, the more we keep forgetting the  basics.

Today while working on some script, I forget the command  which I need to use.

I do know the module name of the command which it belongs to… So I just my little helpful cmdlet Get-Command –Module MoDuleName

and it showed me all the command of that particular module and along some some other useful commands too.

 

Smile 

AmanDhally - PowerShell

Happy PowerShelling..

 

Regards

Aman Dhally

Tuesday, May 24, 2016

PowerShell cmdlet of the Day : Clear-RecycleBin

Do you love sweets? I love them.  And there are some Powershell cmdlets those are tooo sweet like a sweet.

If you want to clear/ empty your recycle bin, there is a very sweet Powershell cmdlet available for it, which is Clear-RecycleBin .

Just run the cmdlet, and it will empty your recycle bin.  You can incorporate this cmdlet to your TEMP file cleaning scripts too.Clear-RecycleBin

If you just run the Clear-RecycleBin, it will ask you for Yes/No confirmation, you can -                        -Confirm:$false to omit it.

Clear-RecycleBin -Confirm:$false
Aman Dhally , Manya Kaur
So sweet isn't? :)
I have tested the above cmdlet on Windows 10 machine :)
Thanks
Aman Dhally , Manya Kaur

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.

Monday, May 23, 2016

PowerShell cmdlet of the Day : Get-PrinterDriver

 

Ok! this is the simple one, it's mainly for the IT/System admins , who spend most of time on user's desk for troubleshooting.

If you are troubleshooting any printer issue, and want to check which printer driver is installed on the users system, shoot the Get-PrinterDriver cmdlet.

Tip : You can also connect to user's system remotely ;)

You can see in below screenshot that it's gives a list of all printer driver installed on the system.

wq1

Thanks :)

take-that

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.

Friday, May 20, 2016

PowerShell cmdlet of the Day : Compress-Archive

In the previous blog post we have seen how to extract a ZIP file.

But what about, how you can create a zip file by using PowerShell.

It's simple again, by using the Compress-Archive cmdlet.  The syntax of Compress-Archive cmdlet is simple, provide the -Path of the folder which you want to compress, then provide the      -DestinationPath of your .zip file and then set a -CompressionLevel, and after that hit enter.

Simple!

Compress-Archive -CompressionLevel Optimal -Path C:\temp\Data\

-DestinationPath C:\temp\aman.zip

 

In the the above command, I have set the -compressionLevel to Optimal , and then  provided the -path of my folder which I wan to zip and then the destination path of new zip file which in aman.zip. And hit enter, in the below screenshot you can see that it has started creating a zip file. 

 

Aman Dhally, Manya Kaur

 

In the below folder you can see, that our zip file is successfully created. Yayyy!!!!!

 

Aman Dhally, Manya Kaur

Thanks for the reading blog post.

Aman Dhally, Manya Kaur

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.