Category "powershell"

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?

Windows ISO 8601 timestamp

I need to convert a date in Windows PowerShell to the ISO 8601 format. In Linux/Unix it was no problem with TZ=0 date -d "<random-format>" +%Y-%m-

Outlook Distribution Lists (DistListItem) are not updated after a referenced contact (ContactItem) is changed

I've gathered some code from around the web to create Contacts and then Contact groups. However, if I update the contact after creation, the "relation" between

Allowing bookings of o365 room for external users

I have a O365 tenant with a bunch of resources (=rooms) in it, e.g. [email protected], and a few users, e.g. [email protected]. The rooms are possible to book for users

powershell command line parameter are executed in uppercase?

I would like to use a WGET command line program under Windows in a powershell script. example : wget https://domain-name/file_01.pdf -o wgetlog.txt Step 1 - E

invoke-sqlcmd empty variable

I am trying to perform an SQL query using Invoke-SqlCmd launching script as inputfile which contains SQLCMD variables, as $(varPROJECTNAME). For example: CREAT

Create outlook profile using vb.net or powershell or cmd

I've got to reconfigure 300 user profiles in the next week or two, changing their outlook from looking at the current exchange server to a new one outside of th

PowerCLI - Finding Virtual Machine via VM IP

I am trying to locate specific VM's based from IP addresses in PowerCLI. I found this script online Grabbing VM ipaddress via PowerCLI The intial question exp

PowerShell Start-Process -redirectStandardOutput throws: The system cannot find the file specified

In a PowerShell window I am executing: Start-Process XXXXX.exe -ArgumentList "some valid arguments" -wait -redirectStandardOutput "D:\\test1.txt" And gettin

Logging into Outlook using powershell with no user logged on

I was wondering if its possible to create a powershell script to log into a specific outlook mail box and than add the script to the scheduled task so that no u

Issues with RegKey in Powershell

I'm having trouble with a Registry Key in Powershell. The key /T/E/S/T gets generated by an unknown process: I then try to overwrite it using: $Path = ".\s

Start-Process -WorkingDirectory as administrator does not set location

When I enter the command Start-Process powershell -WorkingDirectory "D:\folder" it opens new PowerShell window with D:\folder location set. But when I enter

Powershell to find out disconnected RDP session and log off at the same time

Is there a script that can log out my disconnected RDP session from any server? This is causing a lot of pain and constant ad account lockouts. Any help would

Powershell large hex range

I am trying to make a range of hex from a000000000-afffffffff, but the values are too large for Int32. Getting error Cannot convert value "687194767360" to type