What does $ (NOT $_) mean when used by itself?
For replacing User attributes with values of other attributes of that same User, I discovered the following script online:get-aduser User1 -pr supvid, manager | %{set-aduser -identity $_.samaccountname...
View ArticleCounting Specific words in a Text/log file
Hi all, I've been playing around with trying to get a script to do a count of words in an active log file... I want it to count two specific strings, then do a calculation on those strings to produce a...
View ArticleUpdate Active Directory Picture
Chaps.I have pieced something together to update all users in an OU with a picture from a location. I have created a folder on the C:\ADPictures. Lets say I have a user with a SamAccountName of ABC...
View Articledownloading a file from SFTP and calling ps script with batch file
I have a simple ps script to upload a file to a SFTP site. The ps script works fine when I run it from the ps editor or drag the file to an open ps window.When I call the ps script from a batch file...
View ArticleTry/Catch/Finally catch all
I am seemingly confused with regards to try/catch/finally. As I understand it, what I have here should attempt to get the OS data, and if it errors the catch would do.. nothing, and then finally would...
View ArticleExtract PSObject NotePropertys into variables
Say I have a PSObject that has a varying number of NoteProperty fields that I need to split into individual string variables.Here is a sample:PS C:\> $myPSObjIIS Site External IP (F5 VIP)...
View ArticleEnter-PSSession: WinRM cannot process the request, Kerberos authentication...
Hi!I've configured PowerShell Remoting on the server using Enable-PSRemoting commandlet.But when I'm trying to connect to the server I'm constantly getting the following error:PS C:\Users\sergeyp>...
View Articlecount multiple instances of the same process
just trying to determine if you can count the number of instances of the same process. and the output is just the single number.
View ArticleIssue with Pasting to Command Line/PowerShell
Hi,We are unable to paste text from an application other than Command Prompt (CP) or Windows PowerShell (PS) to CP or PS.The issue is only occurring on one of several Windows Server 2008 VMs.The server...
View ArticleChange perl script to powershell
Hi all ,I am new to programming , I would like to get help from this forum.I have a perl program ( about 300 lines ) , I get a request to convert it to windows power shell script , I know it is a...
View ArticleHow to format-table with two different variables
I have a script who's purpose is to go through all the mailboxes in exchange and look for any with SG_ or Group listed in the Full Access Permissions. The script works though I'm having trouble...
View ArticleHow can I construct a variable from concatenated text?
If I have a bunch of variables like so:$WebServerAlphaDescription = "Some interesting stuff about this webserver" $WebServerBetaDescription = "Some interesting stuff about this webserver"...
View ArticleGetting prompted for credentials for invoke command even though suppressed
Hello Team,I am attempting to suppress an credential prompt when running the invoke command - but I am still getting prompted even though I shouldn't be. May I borrow your pair of fresh...
View ArticleHow to use function with ForEach-Object?
PS C:\> Get-WmiObject Win32_LogicalDisk | Where-Object -Property DriveType -eq -Value "3" | ` ForEach-Object { $_.DeviceID, $_.FreeSpace } C: 44025641384 D: 2816375424 E: 48146688560Is it possible...
View ArticleIs there any Ps1 script to pull report of AD object audit logs
Please help me to create Ps1 script to pull report of AD object audit logs 1. AD object modification Event ID 5136Log Name: Security Source: Microsoft-Windows-Security-Auditing Date:...
View ArticleWhile loop using a timer object
Hello Technet,I have a file that gets created every night by a batch job and I need to send that file every night. So, I came up with a method (if there's a better way, I'd like to hear). I created a 2...
View ArticleSMO Table collections issue
Guys, I am having issues in my script when am querying the collection objects in latest SMO (SQl 2012) Using Microsoft.SqlServer.Smo, Version=9.0.242.0 below line returns valid table object. $table =...
View ArticleDBA + PowerShell = Why?
I have been taught that a DBA use PowerShell in the following list: 1. Creating a SQL Server database inventory 2. Listing installed hotfixes and service packs 3. Listing running/blocking processes 4....
View ArticleGet-EventLog -LogName Security -Message
Get-EventLog -LogName Security -MessagePlease help me to create a script to get "message" information as beloweventID,Date of mofification,Subject: ("Security ID:" and "Account Name:"),Object: ("DN:...
View ArticleRegex conundrum
I am looking to replace a particular string with another, but only if it occurs between delimiters, and other text that does not get replaced also could exist between the delimiters. So replacing XXXX...
View Article