
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2039 Articles for Microsoft Technologies

25K+ Views
To install the certificate using PowerShell, we need to use the Import-Certificate command. For example, we have a certificate stored at the location C:\temp\Mycert.cer and we need to install it in the Personal store of the local machine.ExampleImport-Certificate -FilePath C:\Temp\Mycert.cer ` -CertStoreLocation Cert:\LocalMachine\My\You can also use the below method.PS C:\> Set-Location Cert:\LocalMachine\My\ PS Cert:\LocalMachine\My\> Import-Certificate -FilePath C:\Temp\Mycert.cerTo install a certificate on the remote computer, use the Invoke-Command method.SyntaxInvoke-Command -ComputerName RemoteServer1 -ScriptBlock {Import-Certificate -FilePath C:\Temp\Mycert.cer ` -CertStoreLocation Cert:\LocalMachine\My\ }The above command will install the certificate on RemoteServer1 from the path C:\temp of the remote server to the personal store of the remote machine.Read More

4K+ Views
To export or download a certificate from the certificate store using PowerShell, we need to use the command Export-Certificate.First, you need to get the certificate details from the store. If you know the thumbprint, you can directly get the certificate details using the thumbprint and then use that details to export the certificate.Example$cert = (Get-ChildItem Cert:\LocalMachine\My\43E6035D120EBE9ECE8100E8F38B85A9F) Export-Certificate -Cert $cert -Type CERT -FilePath C:\Temp\Mycert.cerIn the above example, we are exporting the certificate from the LocalMachine -> Personal Store. You can choose a different path. Here, the certificate would be exported to the C:\temp\MyCert.cer. You can use the different types like P7B, SST to export the certificate. Alternatively, you ... Read More

5K+ Views
To create a self-signed certificate there are various methods like OpenSSL, IIS, PowerShell, etc. Here, we will see how we can create a self-signed certificate with PowerShell.To create a self-signed certificate with PowerShell, we need to use the New-SelfSignedCertificate command. When you create a self-signed certificate manually, you need to give few properties like DNSName, FriendlyName, Certificate start date, expiry date, Subject, a path of the certificate. Similarly, you can use those properties for this command to create it. Not all properties are mandatory.ExampleNew-SelfSignedCertificate ` -CertStoreLocation Cert:\LocalMachine\My ` -DnsName "testdomain.local" -VerboseOutputPSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My Thumbprint ... Read More

4K+ Views
To create any dummy file of having any size with PowerShell, we can use the below command.Example$f = new-object System.IO.FileStream c:\temp\test.dat, Create, ReadWrite $f.SetLength(50MB) $f.Close()The above command will create 50MB of Test.dat dummy file in the C:\temp. Such files are used for testing purposes.

541 Views
To get the default documents stored on the IIS default website page, you can use the below command.ExampleGet-WebConfigurationProperty -Filter //defaultDocument/files/add -PSPath 'IIS:\Sites\Default Web Site' -Name value ` | select valueOutputValue ----- Default.htm Default.asp index.htm index.html iisstart.htmTo check if the Default document contains a specific file, (Get-WebConfigurationProperty -Filter //defaultDocument/files/add -PSPath 'IIS:\Sites\Default Web Site' -Name value).value -contains 'iisstart.htm'The above command checks if the IIS default website contains any iisstart.htm on the default document page.You can also use another website instead of using 'Default Web site'. To get the default documents file at the IIS level, (Get-WebConfigurationProperty -Filter //defaultDocument/files/add -PSPath 'IIS:\' ... Read More

10K+ Views
To copy only updated or newer files with PowerShell, we can use Copy-Item with some logic in the script that to check if the files exist on the destination folder if not then copy that file and if yes then compare the timestamp and copy the latest file. This would be tricky because we need to write several lines of code for it.But Windows support xCopy utility which can directly copy the newer or updated files and this utility we can accommodate in PowerShell as well.xCopy uses a switch called /d. its actual syntax is, Syntax/d [:MM-DD-YYYY]This means if the date ... Read More

8K+ Views
To check if the VMs are running, deallocated, or stopped using PowerShell, we need to use the - Status parameter.If you write only the Get-AzVM command to get the VM details, it won’t show up the Azure VM power status default.ExampleTo check the Azure VM Power Status, Get-AzVM -statusOutput The above command will show the Power State for all VMs for that particular subscription. For different subscriptions, you need to change the subscription and run this command.To get the VM Power State for the specific ResourceGroup, use the ResourceGroup name parameter.ExampleFor example, Get-AzVM -ResourceGroupName TestVMRG -StatusThe above command will retrieve all ... Read More

8K+ Views
Get-SmbShare gives all the shared folders on the local system.PS C:\Temp> Get-SmbShare Name ScopeName Path Description ---- --------- ---- ----------- ADMIN$ * C:\Windows Remote Admin C$ * C:\ Default share DSC * E:\DSC E$ * E:\ Default share IPC$ * Remote IPC Shared1 * E:\ExtractExampleTo ... Read More

22K+ Views
To get the shared folder permissions using PowerShell, we can use the Get-SmbShare cmdlet.For example, we have a shared folder name DSC and we need to retrieve its permissions, we can use the below command.CommandGet-SmbShare -Name DSCOutputName ScopeName Path Description ---- --------- ---- ----------- DSC * E:\DSCIt doesn’t show the permission by default and we can retrieve the full list using Fl *. For example, Get-SmbShare -Name DSC | fl *And you can see the PresentPathACL property there. This property is used to retrieve the permissions on the shared folder. So we can directly use the command, Command(Get-SmbShare -Name ... Read More

7K+ Views
We can use the command Grant-SmbShareAccess to change the shared folder access permission or to assign the new user to the shared folder with permission.In this example, we have already shared a folder name called “Shared Folder” and everyone's user permission is assigned with the read access and we will change it to the Full access permission.PS C:\Temp> Get-SmbShareAccess -Name "Shared folder" Name ScopeName AccountName AccessControlType AccessRight ---- --------- ----------- ----------------- ----------- Shared folder * Everyone Allow ReadExampleTo change the permission ... Read More