Windows Server
129 TopicsFC Target discovery
I was looking for a way to discover FC targets for each initiator. Searching on the web I found this code # Get all initiator ports (HBA ports) $initiatorPorts = Get-InitiatorPort # Loop through each initiator port and list its targets foreach ($port in $initiatorPorts) { Write-Host "Initiator Port: $($port.NodeAddress) - $($port.PortAddress)" $targets = Get-InitiatorTarget -InitiatorPortAddress $port.PortAddress foreach ($target in $targets) { Write-Host " Target: $($target.NodeAddress) - $($target.PortAddress)" } } But is not working because the Get-initiatortarget is not recognized as valid command. Is there a way I can do it thanks102Views0likes2CommentsPowerShell implicit remoting without connection to server
When I start a PowerShell session on my local computer, and then run: Get-Module -Name FailoverClusters I can see that implicit remoting is used (and I can see the temporary files generated for this), and an output is generated. Needless to say that I don't have the FailoverClusters module installed anywhere on the local machine (I've verified $Env:PSModulePath as well). I don't have any connection to a server when running the command. Maybe somebody can explain to me what PowerShell is doing to find the FailoverClusters module and the cmdlets contained therein?254Views0likes8CommentsSecure Way to store lots of credentials using powershell
Dear Community I wanted to ask if there is any way I can store lots of creedentials while still being able to use them in Powershell? I dont want to enter anything in a popup window, because there are way to many credentials to to that by hand. Is it possible that I can just put them in some kind of file and then get the wanted informations (while the file or its contents are somehow encrypted)? Thanks in advance MartinSolved22KViews0likes6CommentsHyper-V orphaned or unnecceasry file script
I am trying to create a script that I can run against a Hyper-V cluster or host that can scan and identify orphaned files or files that are unused. THe idea is to clean up a cluster that has a lot of messy files because of migrations, or failed backups, snapshots, etc.311Views0likes3CommentsPowershell 7 getting error updating multi-valued attribute using Set-ADUser. PS 5.1 works
Hi there, I recently moved to PS 7.4 since there is some additional commands related to parallel threads. Now I'm facing an unexpected error due to multivalued updates using Arrays. It says "Invalid type 'System.Collections.ArrayList'" using the following command (that works in previous PS versions): Set-ADUser -identity "user" -Replace @{uid=@("value1","value2")} Already tried many options, like using variable, explicit array declaration and followed Copilot suggestions, but no success yet. It seems like a bug for me. Does anybody knows how to overcome this issue?220Views0likes3CommentsNot able to export AD attribute departmentnumber
Hi, I'm trying to generate a report for all AD users with some AD attributes, such as SamAcconutName, department, departmentnumber, etc. The report is fine with all except departmentnumber. it shows "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" instead of actual number. Here is my PS cmdlet. get-aduser -Properties * | select displayname, departmentnumber | Export-Csv c:\temp\users.csv -NoTypeInformation When tested against a single AD account using the same cmdlet, the screen output shows the value with { }, for example, {123456} instead of 123456. employeenumber attribute worked fine. The same cmdlet shows just the number. Please help, How can I query and export attribute departmentnumber in a report properly? Thanks, Dave719Views0likes4CommentsDoes Microsoft stop support WMIC or WMI?
Hello everyone, Nice to meet you! I heard that MS has plans to deprecate and stop supporting the VB script very soon. I have few queries, please clarify Does Microsoft stop supporting WMIC or WMI along with the VB script? Can we use WMI commands in PowerShell scripts? thanks Madhu101Views0likes1CommentGet command status from Active Directory Domain machines
We need to get the status of few commands from a domain environment of around 400 machines. All may be windows 10 and windows 11 machines. Need to run this activity couple of times in a day. This may required few Power Shell commands with admin credentials OR we may run this from GPO. But I don't know where can we save the status result from machines (Power Shell script running is disabled via GPO so we may need to run PowerShell commands directly) Commands status result are required (windows 10/11): - Last Windows update status - Bit Locker installed and configured status - Total Local Admin users - LAPs is installed on not on machine379Views0likes4CommentsHow do I permanently store module?
Hi everyone, I'm new to powershell, I would like to know how to automatically load the modules I load with import-module in each instance; if I load the modules with import-module, when I close the instance I lose the module. I would like to know how to permanently load, for example, the KPI module in the $Env:PsModulePath variable. Obviously the question is answered to all the modules that I always want to keep in section even when I start the computer. I hope for an answerSolved545Views0likes4CommentsHow do I display a "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" using PowerShell
PS C:\Users\serveradmin.QA> Get-ADDomainController -Filter * | Select-Object Name, OperationMasterRoles |Where-Object {$_.OperationMasterRoles} Name OperationMasterRoles ---- -------------------- ADAICTQA {SchemaMaster, DomainNamingMaster, PDCEmulator, RIDMaster...} in the above command I output OperationMasterRoles Id like those to be displayed in the same row comma seperated ...how do I disect that ADPropertyValueCollection ?461Views0likes1Comment