How to create contact list items in a SharePoint 2013 contact list with PowerShell?

PowerShell
I'm trying to create contact list items in a SharePoint 2013 contact list with powershell. Creating items itself is not that hard: $spWeb = Get-SPWeb...
3 years ago

What's the best way to determine the location of the current PowerShell script?

PowerShell
Whenever I need to reference a common module or script, I like to use paths relative to the current script file, that way, my script can always find o...
2 years ago

Elegant way to get around scoping issues with powershell jobs

PowerShell
I have functions in separate files I need to run as jobs in one main file. I need to be able to pass these functions arguments. This is what I have:...
2 years ago

How do I replace a backslash and newline character in sequence using regular expressions in Powershell?

PowerShell
Say I have a file of text where lines have been wrapped deliberately. Each wrapped line ends with a backslash character '\' and then a newline. Exampl...
2 years ago

powershell - extract file name and extension

PowerShell
I need to extract file name and extension from e.g. my.file.xlsx. I don't know the name of file or extension and there may be more dots in the name, s...
2 years ago

Splitting CSV file by two columns

PowerShell
Starting with a 500,000 line CSV, I need to split the files by day and hour (the second and third columns). I've tried the modify the group to include...
2 years ago

Running Basic Powershell Commands in C# Error cmdlet not found

PowerShell
I have a C# console program and I want to run powershell commands NOT SCRIPTS, but no matter what command I try to run in the powershell runspace, it ...
2 years ago

The term 'Install-Module' is not recognized as the name of a cmdlet

PowerShell
I am following the directions to install poshgit. In doing so I ran: Install-Module posh-git Error: The term 'Install-Module' is not recognized...
3 years ago

#Requires doesn't see the module, Import-Module works

PowerShell
When I run a simple script with #Requires -Version 4 -Modules TestModule statement at the first line, I get an error: The script 'TestScript.ps1' ...
3 years ago

Run a batch file in an externam CMD window from PowerShell

PowerShell
I have a PowerShell script that runs on startup and creates a couple of batch files. I need to create the batch files (as opposed to run them directl...
3 years ago

Catch error invalid namespace "root\SecurityCenter2"

PowerShell
Trying to retrieve the list of installed antivirus with on remote computers with below command. Get-WmiObject -Namespace "root\SecurityCenter2" -Clas...
3 years ago

Is a hash table the way forward?

PowerShell
I have a variable that looks like this: Plugin ID : 66334 Host : GCAB-L7-449090L Plugin Output : . Microsoft Operating System Patches : ...
3 years ago

Removing white spaces from string line and using it in an array

PowerShell
I was looking through the old posts but I cannot find the very specific answer how to replace the white space in the string and then use it as an arra...
2 years ago

How do I import functions in separate files into a main file and run them as jobs?

PowerShell
I already asked a somewhat related question here. I have a bunch of functions in separate files dot sourced in one main file how would I call those f...
2 years ago

Powershell to split Display name and use it to populate First Last name

PowerShell
Need some help with my code. I have users in OU, they have Display Name attribute but First/Last name are empty. I am trying to populate them using po...
2 years ago

Powershell switch staging to production

PowerShell
I have cloud service in azure. And I have powershell script on continuous integration. I need on this powershell script switch staging to production....
3 years ago

Create CSV file in each subdirectory of target directory

PowerShell
I have folder with files as below: D:\TESzz\Background\BG_Flash-Zootopia-HD-Desktop-Wallpapers.jpg D:\TESzz\Background\BG_NimmHBD.jpg D:\TESzz\Backgr...
2 years ago

Rename parts of file names that match a pattern

PowerShell
Say I have a list of file names like this: some-file.ts my-project-service.ts other.ts something-my-project.ts I need to change the file nam...
2 years ago

Try Catch not as intended

PowerShell
So I have this script working except I cannot get the computer name to display when there is an error, I understand that is because the computer is of...
2 years ago

Getting AD users having a specific keyword within description field in AD

PowerShell
I want to get all of those users starting with a specific keywords in AD User Description field using PowerShell. Keyword: Could not execute powershel...
3 years ago