Questions tagged [powershell-v5.0]
The powershell-v5.0 tag has no usage guidance.
59 questions
1
vote
2
answers
1k
views
After installing PowerShell-7.4.1-win-x64.msi, $PSVersionTable still shows 5.1.22621.2506
I have installed PowerShell-7.4.1-win-x64.msi, but $PSVersionTable still shows version 5:
PS C:\Users\firerose> $PSVersionTable
Name Value ...
0
votes
1
answer
2k
views
Error when importing certificate via PowerShell to Local Certificate Store. Missing PrivateKey Information
I have have tried the following ways to import a certificate to the localmachine store via PowerShell. The console was running as administrator.
Import-PfxCertificate -Exportable -Password (secure....
0
votes
1
answer
3k
views
Send-MailMessage thorugh Office 365 operation times out
I need to send an email report from a script. If I do this from one of our mail relays the email appears as [EXTERNAL]. Since this report includes links, I want users to trust it as coming internally.
...
0
votes
1
answer
396
views
Powershell - Get-ADOBJECCT Trying to show a subset of values of a custom class
Here is my script that works great:
Select-object -Property name,@{Name="bofaamlmember";Expression={$_.bofaamlmember -join ";"}},@{Name="canonicalName";Expression={$_....
1
vote
2
answers
7k
views
How to install DFSN module in powershell?
I have two machines, one has DFSN available (functions like Get-DfsnFolderTarget, etc) and the other doesn't.
I can't seem to find any information online about installing it, and I'm not a powershell ...
0
votes
1
answer
860
views
PowerShell, Active Directory Get-object issue
I have been tasked to create a list of members of a custom object/custom attribute in Active Directory. I felt the best way to do so is use PowerShell. I can list the objects in a specific OU, but I ...
0
votes
1
answer
3k
views
Service Account Permissions for Task Scheduler READ
I have a PowerShell script I've written to do a comparison of Scheduled Tasks between two nodes of our application server cluster. It uses this code to query the tasks from a given server...
function ...
1
vote
1
answer
4k
views
Powercli create local user and assign permission At VC level
I need a powercli script to automate some task in VC , I have found below script but here I can assign AD group permission to folder level. but I want to assign permission at VC level. is there any ...
2
votes
1
answer
945
views
PowerShell object browser
I vaguely remember a tool I used in the dark ages of PS 2.0. The best I can describe it is, you pipe an object to it, and it gives you a GUI that lets you "browse" or "explore" the ...
1
vote
0
answers
207
views
WSMAN error using Register-PSSessionConfiguration
Windows Server 2016 v1607 Build 14393.3930
PowerShell 5.1.14393.3866
This is a Google Cloud VM
I am teaching students some basic PS Remoting. Set up a simple DNSOps group and use ps-remoting to show ...
0
votes
1
answer
257
views
Automating the downloading of data from a website
I am writing a powershell script to extract data from OpenStreetMap automatically for a country. My whole script is written, but not quite functional. My script below:
$ie = New-Object -ComObject ...
1
vote
0
answers
397
views
How do I send about a million files asynchronously with Start-BitsTransfer in PowerShell 5.1?
I am attempting to transfer about a million files of various sizes from one server to another, and due to various size, network and time constraints, I'm attempting to use BITS in PowerShell to do the ...
1
vote
1
answer
803
views
Why Get-SmbOpenFile losses the lock when file still opened at remote
I am using Get-SmbOpenFile, But surprisingly, it looses its connection and I can see that there is no lock even after couple of seconds later on the file any more, even it is still opened. I safely ...
1
vote
1
answer
1k
views
Win Server 2016 - Event ID = 300, X509 store location WindowsPowerShell is not valid
I have a Windows Server 2016 (Build 14393) that I'm running NPrinting on (possibly not relevant). I performed an update on Friday night, and I am seeing EventID=300 errors. Below is the full text of ...
0
votes
1
answer
5k
views
Executing Remote commands on target machine via WinRM in workgroup environment
I'm looking forward to run special commands on a target machine in my local network (workgroup, no domain join).
The machines have been previously configured with Enable-PSremoting etc.. to tolerate ...
1
vote
1
answer
811
views
I want to delete 30 days old folder + sub folder by using Powershell were folder save in date wise
I want to delete 30 days old folder & all sub folder which name start "dba_20200312-0500311 - 123"
# $curDateTime = Get-Date -Format yyyyMMdd-HHmmss, folder save in this date format
$mydays = (...
2
votes
1
answer
152
views
Windows 2016 powershell and NuGet Errors
I am trying to install the Windows 2016 RDWeb HTML5 client on a Windows 2016 RDGW server using these instructions from Microsoft CLICK HERE
I was able to successfully do this on one of our regional ...
0
votes
2
answers
690
views
delete unnecessary settings from GPO
I want to delete some unnecessary settings from one GPO. I use windows server 2016, and i have unnecessary registry settings which i don't want to appear in my GPO.
It is possible to perform this ...
2
votes
1
answer
2k
views
How do I compare two folders in powershell 5.1?
I'm having a really difficult time figuring out what PS is trying to tell me. I've created a script that is intended to compare the files in two directories. I want to output any differences in Name, ...
1
vote
1
answer
366
views
Coping folders from location listed in a text file to a new location
I have a text file "FromTo.txt" which contains folder paths, for e.g.
C:\Documents\Files\From\Folder1
C:\Documents\Files\From\Folder2
C:\Documents\Files\From\Folder3
C:\Documents\Files\From\...
0
votes
1
answer
187
views
Stopping powershell background jobs at a scheduled time?
I started a few powershell jobs and I want to stop them at a scheduled time. I know the command to stop them is Stop-Job -Name $someName but I don't know how I can schedule this.
I mean I realize ...
1
vote
1
answer
2k
views
Are Powershell's New-NetFirewallRule and Set-NetFirewallRule inconsistent?
I noticed that the PowerShell New-NetFirewallRule cmdlet does not behave like I expected. When calling the commandlet repeatedly, it will create multiple entries with the same name.
For example, when ...
1
vote
0
answers
420
views
Permanently load environment variable on aws ssm login in windows PowerShell
I am using ssm login for logging into my windows server 2016 data center edition. When I make a RDP connection and run PowerShell from RDP, All the system environment variables are loded correctly ...
0
votes
0
answers
773
views
PowerShell function parameter becomes null inside try block
I'm putting together a powershell zip in transit script that would be called via a function, but it keeps saying the path is null after it creates the zip file. After running the script in ISE I then ...
1
vote
0
answers
985
views
MD5 hash comparison over SMB SLOW
I'm scripting a full backup solution in powershell on Windows server 2016 for Hyper-V VM's and have run into the issue that calculating the MD5 hash over the network on a mounted network drive across ...
1
vote
1
answer
170
views
DSC not pulling config
my DSC node is not pulling the DSC config from my SMB DSC server. Get-DSCConfigurationStatus says the pull was successfull but Get-DSCConfiguration remains the same(old config).
Im testing it with a ...
1
vote
1
answer
3k
views
Run Direct Access cmdlet remotely
I have a DirectAccess server up and running, has been for years and all is fine. But a nagging problem or issue that I have just never figured out is that I am trying to run the cmdlet Get-...
2
votes
1
answer
1k
views
Powershell, how to compare user input
I'm making a "shortcut" PS1 script to update a domain user's password. I'd like to prompt the user for the new password twice without showing the password on screen. When I use $Text1=Read-Host ; $...
2
votes
1
answer
3k
views
Proper method for detecting Apache Tomcat installation via PowerShell?
What's the proper method for detecting whether an arbitrary version of Apache Tomcat is installed on a given Windows server, which we can assume to be Windows Server 2012 R2 or greater, using ...
1
vote
1
answer
571
views
Powershell Array for Path
We are trying to break the following Path from the text file, the path is dynamic in length, i.e, it can be ABC\DSD\AAR\ARE or ABC\DSD.
So we need a solution to break down the path as per the ...
0
votes
1
answer
264
views
PS-Remote shell access to a user
I am currently adding Full control to an user manually. Please see below screen shot.
But this needs to be done via a PS script.I followed https://blogs.technet.microsoft.com/heyscriptingguy/2010/11/...
-1
votes
2
answers
2k
views
Powershell script Needd to set the state of Allow Remote Shell Access [closed]
I am looking for a script which will set the value to "Enable/Not Configured/Disable" of Allow Remote Shell Access in Gpedit via Powershell script.
Below value state value should get changed to ...
1
vote
1
answer
12k
views
How to properly run Powershell scripts containing BITS operations from Task Scheduler?
I am trying to perform an automatic backup of some files and folders based on a configuration. This is done using Powershell 5 which in turn relies on Background Intelligent Transfer Service (BITS). E....
1
vote
2
answers
821
views
How to access result and volume of WindowsServerBackup via PowerShell?
I want to check automatically the latest WindowsServerBackup result via PowerShell on Windows Server 2012/2012 R2.
It's not only "success" or "failure" but "backed-up volume" and "error message", too....
2
votes
3
answers
9k
views
Get-ADUser WhenChanged and WhenCreated are empty for some users
I've built a PowerShell 5.1 script to export all the users in the DB and save all the data in to a CSV file. The script allows you to set a date back in time so you can decide since when you'd like ...
0
votes
1
answer
322
views
Loaded PS Modules not included when Powershell is called via PHP
Good day everyone. My question is about calling a powershell script using PHP. So, if I am calling a PS1 script using ActiveDirectory module, there are no issues.
However, if I am calling PS1 scripts ...
1
vote
1
answer
633
views
powershell 5.1 on windows server 2016 not working
I'm following exercise 1 of this Microsoft official Azure lab under the heading Deploying Azure SQL Database by using the Azure PowerShell. The VM machine in the lab is Windows Server 2016. When I run ...
0
votes
1
answer
404
views
Azure VM size A1 Basic not available
I'm following an official Microsoft tutorial on Azure with free trial where they ask us to create a VM of size A1 Basic on a region closer to you. But when I select any of the following regions, I see ...
0
votes
1
answer
361
views
Using Azure Powershell - How to get image name for the newest image of Windows Server Data Center
I created a VM using Windows Server 2012 R2. Now trying to acquire the image name for the newest image of Windows Server 2012 R2 Datacenter using following `PS 5.0`` script. But it gives the following ...
4
votes
3
answers
11k
views
Powershell - Add-LocalGroupMember - make silent when member exists
I can use Add-LocalGroupMember to add a user to the local group:
Add-LocalGroupMember -Group "Administrators" -Member "foobar"
but it isn't idempotent. If the user already exists then you get this ...
1
vote
1
answer
11k
views
How to tell what Operating System is running in HyperV VM with Powershell
So here's the environment.
Host: Windows 10
Guests: Server 2012 and Server 2016
Purpose: Development system to automate pushing out builds to servers for testing during development.
I've got a ...
0
votes
2
answers
1k
views
Powershell script to create new users and move them into OU based on user description fails to move users
This script will create the new users, but it won't then move them based on the user's description? Edit, it appears that Powershell is showing the description field as blank, but it's populated in ...
1
vote
2
answers
1k
views
Pushing a hosted Registry File to Multiple Servers
I have bunch of Servers I need to push this patch through. Normally I would load up a WSUS or equivalent. However I would like to get this working in a DSC enviroment. So I am testing scripts to put ...
3
votes
0
answers
164
views
Regulate Implicit Remoting Sessions
Summary:
After running netstat, I noticed that my local device has several established connections to the remote server using port 5985 as seen below:
PS > netstat
Active Connections
Proto ...
0
votes
1
answer
98
views
How to get PSGet up and running from scratch
On a new build machine with PowerShell 5.0, how do I configure PSGet so it actually just works?
I think it needs me to tell it what package provider I want and then what repository? And I'm behind a ...
2
votes
0
answers
622
views
DSC Environment resource failing to see environment variable it has set
I'm using DSC to provision virtual machines. The VMs are setup to pull a DSC configuration from a pull server. All is well with this. However, I noticed that I am frequently seeing:
Job {8B376B76-...
1
vote
1
answer
1k
views
Load a nuget package installed by Install-Package in Powershell v5.0+
In Powershell v5.1... If I install a .NET NuGet package (example: redmine-api) using this command:
Install-Package redmine-api
How do I then create a new object from that package for use in ...
1
vote
0
answers
5k
views
Go to network share\folder with Powershell
I'm trying to access a network share in PowerShell 5.1 with elevated permissions executing the following command:
gi "\\192.168.1.1\data"
I'm recieving the following error:
gi : Cannot find path '\\...
3
votes
1
answer
2k
views
How to obtain IP Address of Windows 2008 R2 VM on Hyper-V with PowerShell?
I have created an automated build script to build new VMs on Hyper-V 2016. I sometimes need a 2008 R2 VM and the way I obtain the IP Address to connect to my 2012 R2/2016 VMs is to use some powershell ...
1
vote
0
answers
992
views
How can I scrape the Meraki client page for devices and their owners?
I am trying to automate a weekly process where I download a CSV copy from the Client page on the Meraki website.
Before I lose you I am aware there is an API and it works very well. However there in ...