Category "powershell"

How to stop a windows 10 machine from sleeping/hibernating down when running a powershell process?

I have a powershell process that reads records from a remote server and copies them into a local database. When it runs, it might run for 8-12 hours. How do I p

Cannot start service on computer '.'

I'm trying to create and start a windows service using PowerShell. The service is created but cannot be started when I use various names besides one particular

How to enable auditing on subfolders and files using powershell

I tried to enable the audit policy on folder using powershell script. But in my case the audit policy is not applied for subfolders and files within the folder

Team Foundation Server(Release Pipeline)

I'm developing Release pipeline for deploying artefacts using TFS 2017 Update3 Release Management. There are various tasks like "Windows Machine File Copy" and

Get date and time on the same line

I can use date /t and time /t to get the date and time, but it doesn't display it next to each other. I wanted to make it do that and display like this: Curren

How do I remove the cruft at the start of my posh-git window title?

I'm using posh-git for my powershell window, and the prompt is perfect: S:\Repos\DevTools [master ≡ +1 ~2 -0 !]> But the title of the window has ext

convert "Yes" or "No" to boolean

I want to parse user values contained in .CSV file. I don't want my users to enter "Yes" or "No" but instead enter "True" or "False". In each case I want to c

PowerShell Version check prior to script execution

I'm just asking the communitty if they have come across a way to have the a script check what version of POSH is running prior to the execution of the script.

How can I pull Mail Contact groups for each contact with powershell?

I am trying to create a script to pull contact groups and put them in an excel sheet. Here is what I have so far: Import-Module ActiveDirectory Get-ADUser -Sea

Datadog Agent installation on Windows

I am trying to install the Datadog agent on Windows using PowerShell only, not manual however, the APIKEY is not being setup. Is there a way to update/set the A

Get the last command executed on a PowerShell script

I'm updating the logging function I use for all my scripts and making it compatible with the SCCM logging viewer. Under the fields that the SCCM viewer takes i

Specifying complete installation option when running msi from powershell

I am trying to automate the installation of gstreamer on windows using powershell I have the msi file downloaded, and am installing it as shown below PS C:\User

Unable to connect to the server: dial tcp: lookup <Server Location>: no such host

I'm beginning to build out a kubernetes cluster for our applications. We are using Azure for cloud services, so my K8s cluster is built using AKS. The AKs clust

How to check if a DateTime value is not null or empty?

I want to check if the DateTime field is not an empty\null string. if datetime field is not null then I will do stuff. [DateTime]$expdate = Read-Host "Expirati

How to get item ID of the last modified item in the SharePoint online list using pnp powershell?

I am able to get the date of the last modified item in the list using the script below: $SiteURL="https://abc.sharepoint.com/sites/sitename" $ListName="Document

Is it possible to use with and endwith instructions?

I am translating vba code to PowerShell Does with and endwith exist in PowerShell? What is the alternative? Could you give me an example?

Download files from SFTP server using PowerShell

I need to download files from SFTP server to a local machine using a PowerShell script. The API/library that will be used for the download needs to be able to

How to access outlook object using powershell script without a security prompt?

I have prepared powershell script which access outlook to save the attachment and prepare the new report. Currently my script always ask/throws the pop up askin

Create show-menu in powershell depending on variables

I want to create a menu with show-menu that will depend on what is present on the computer. I want to list in the menu usernames available on c:\users\ (based

Powershell - Fastest way to write large body of text to a file

In terms of runtime performance, which is the fastest method in powershell to write a large body of text into a file?