Quantcast
Channel: Windows PowerShell Forum
Browsing all 2562 articles
Browse latest View live

Regex pattern - get PC hostnames from txt file

Hello, im trying to extract hostnames from log file, these hostnames are written in their UNC formatLog.txt example:\\pc-xp1 random text..  .. random text ...   \\pc-xp2 ... another random text...

View Article


Trying to get size of each database - loop not working

I am trying to get the size of each SQL database.  $servers | Set-Content 'c:\temp\servers.txt' #Loop over each instance provided foreach ($server in $servers) { try { "Connecting to $server" |...

View Article


Until Statement

How can i shorten this statement? until (($a -eq "1") -or ($a -eq "2") -or ($a -eq "3") -or ($a -eq "4") -or ($a -eq "5") -or ($a -eq "6"))

View Article

Invoke-Sqlcmd return error from stored procedure

I must be misssing something obvious. I am working with Powershell v3 ISE on Windows Server 2008 R2. I cannot figure out how to execute "only" a stored procedure specified in the -Query parameter of...

View Article

PowerShell 3.0 - Invoke-WebRequest -Method parameter

Cannot bind parameter 'Method'. Cannot convert value "SEARCH" to type "Microsoft.PowerShell.Commands.WebRequestMethod". Error: "Unable to match the identifier name SEARCH to a valid enumerator name....

View Article


Create a custom table

I run into the same problem all the time. I want to create a custom table. I want one column to be the computer name of the system I'm getting data and the other column to be the data. Here is an...

View Article

How to install Additional printer driver via a script?

Hello!I have a task to add additional Windows 7 x64 printer drivers to more than 3000 print queues hosted on windows 2003 r2 x32 servers.Is there a way to proceed the process with some script?A was...

View Article

Trim after specific character

Hi I have a folder filled with files that all have a year in (XXXX) but all after that i want to remove. Is it possible, thought maybe like this: .TrimEnd(")*") Yet it doesent work. Regards.

View Article


powershell ps1 startup script doesn't work

hi friendsin my test lab , i have a dc (win2008 R2) and a some member servers ( win2008 R2) and i need to install some roles and features on my servers centrally ( via domain group policy startup...

View Article


Distribution Group in details report

Hi,I'm still new in PowerShell but I'm trying to get a list of users from all distribution groups and who have authority to send mails to these groups "AuthOrig"Distribution Group Name | Display Name |...

View Article

Extended Ascii characters showing as question marks in cat'd file using...

I am attempting to read a number of ASCII encoded files, and concat them into one ASCII encoded file, but characters in the extended ASCII family are showing up as question marks (?) in the concat'd...

View Article

Need to force a password reset for every user in the entire organization...

I'm looking for an Office 365 powershell command (or two) that would let me force a mandatory password reset for the entire organization.I'd like this to happen to every user as soon as possible.Does...

View Article

Catch specific event ID from list of servers.

Hi everyone.I'm new to powershell so be gentle :DI'm trying to put a script together that scans the system log of my servers for a specific event id (301 - drive failure) and spits that out to a html...

View Article


PowerShell Script for Bulk service account creation

I have tried to create a script to create bulk user objects in AD.#Script to create bulk generic user account creation param($OU=$(throw "You must specify the path")) $password = Read-Host "Enter...

View Article

Powershell vhdx size

Is it possible to get not attached vhdx free space using powershell

View Article


Command succeeds in PowerShell console but fails when executed from ISE -...

I have a script that automates Node.js application deployment and in the process calls`npm install`This command works OK in both cmd.exe and powershell.exe but fails when executed from the script area...

View Article

Check if file created today and not 0 KB

I would like to create a script to check a list of directories if any file was created today and is not 0 KB, if any of the two conditions are not met it should send an email.Folder...

View Article


Win32_process remote execution and getting output

Hi,I want to remote execute a command on cmd line on remote computer using Win32_Process and be able to read the output of the command execution. For example if I have somthing.exe / dir (a dos...

View Article

invoke-sqlcmd not outputting result of select query

This is driving me nuts, what could possibly make invoke-sqlcmd NOT output the result of a simple select statement ? <# repli rowguid renum via BCP ############################ # MUST BE RUN @...

View Article

Adding multiple aliases (Office 365)

Dear,I have the followingOffice 365environment:Tenant: Contoso.onmicrosoft.comMain Domain: contoso.comNumber ofusers: 600The company thatownsthistenant, has over47 domain, andwant eachuser hasan...

View Article
Browsing all 2562 articles
Browse latest View live


Latest Images