-
Posts
1,570 -
Joined
-
Last visited
-
I have this rather fabulous script which launches a page for users which is different depending on their ip address... function getipthirdoctet { ipconfig | where-object {$_ –match “IPv4 Address”} | foreach-object{$_.Split(“.")[-2]} } $ipaddress = getipthirdoctet if ($ipaddress.length -eq 1) { $ipaddress ='0'+$ipaddress } C:\Progra~1\Intern~1\iexplore.exe -k "http://intranet/?i=$ipaddress" However I am having serious problems with powershell security so i am seeing if any edugeekers can suggest an alternative to powershell that might do the same thing. Can anyone help?
-
Self signing looks like a lot of work!
-
So I have this now thanks... - - - Updated - - - And now my remote computers will not run unsigned powershell scripts so i may have to do this with vbs instead!
-
Not silly at all. I really rushed through this to get it onto a system quickly but then now have time to give it a bit more thought!
-
I have created this script but I'm not convinced that this is the shortest way to do the if statement, can anyone suggest how this could be shortened? function getipthirdoctet { ipconfig | where-object {$_ –match “IPv4 Address”} | foreach-object{$_.Split(“.")[-2]} } $ipaddress = getipthirdoctet if ($ipaddress -eq 1) { $ipaddress =01 } Elseif ($ipaddress -eq 2) { $ipaddress =02 } Elseif ($ipaddress -eq 3) { $ipaddress =03 } Elseif ($ipaddress -eq 4) { $ipaddress =04 } Elseif ($ipaddress -eq 5) { $ipaddress =05 } Elseif ($ipaddress -eq 6) { $ipaddress =06 } Elseif ($ipaddress -eq 7) { $ipaddress =07 } Elseif ($ipaddress -eq 8) { $ipaddress =08 } Elseif ($ipaddress -eq 9) { $ipaddress =09 } Thanks
-
Wow thanks, I only put that on as an afterthought. My fault for reading the error too literally. Thanks
-
Hi, I have a script that I run to remove rogue Hotfixes when SCCM will not remove them quickly or has issues... function Uninstall-Hotfix { [cmdletbinding()] param( $computername = $env:computername, [string] $HotfixID ) $hotfixes = Get-WmiObject -ComputerName $computername -Class Win32_QuickFixEngineering | select hotfixid echo $computername echo $HotfixID if($hotfixes -match $hotfixID) { $hotfixID = $HotfixID.Replace("KB","") Write-host "Found the hotfix KB" + $HotfixID Write-Host "Uninstalling the hotfix" $UninstallString = "cmd.exe /c wusa.exe /uninstall /KB:$hotfixID /quiet /norestart" ([WMICLASS]"\\$computername\ROOT\CIMV2:win32_process").Create($UninstallString) | out-null Start-Sleep 6 Write-Host "Waiting for update removal to finish ..." write-host "Completed the uninstallation of $hotfixID" } else { write-host "Given hotfix($hotfixID) not found" return } } # Remove hash below to run on certain asset and remove certain kb Uninstall-HotFix -ComputerName TeacherPC -HotfixID KB3008923 I am trying to run this against a list of computers from a text file, so I found this one as an example that gets bios info... $a = Get-Content "H:\Scripts\Powershell\Run command from text list\MachinesWithHotfix.txt" foreach ($i in $a) {$i + "`n" + "=========================="; Get-WMIObject Win32_BIOS -computername $i} So I tried to cram these two together to get the hotfix removal to run against a list like this... function Uninstall-Hotfix { [cmdletbinding()] param( $computername = $env:computername, [string] $HotfixID ) $hotfixes = Get-WmiObject -ComputerName $computername -Class Win32_QuickFixEngineering | select hotfixid echo $computername echo $HotfixID if($hotfixes -match $hotfixID) { $hotfixID = $HotfixID.Replace("KB","") Write-host "Found the hotfix KB" + $HotfixID Write-Host "Uninstalling the hotfix" $UninstallString = "cmd.exe /c wusa.exe /uninstall /KB:$hotfixID /quiet /norestart" ([WMICLASS]"\\$computername\ROOT\CIMV2:win32_process").Create($UninstallString) | out-null Start-Sleep 6 Write-Host "Waiting for update removal to finish ..." write-host "Completed the uninstallation of $hotfixID" } else { write-host "Given hotfix($hotfixID) not found" return } } $a = Get-Content "H:\Scripts\Powershell\Run command from text list\MachinesWithHotfix.txt" foreach ($i in $a) {$i + "`n" + "=========================="; Uninstall-HotFix -ComputerName $i -HotfixID KB3008923 > H:\Scripts\Powershell\Run command from text list\HotfixRemoved.txt } But this gives me an error ... Am I going about this the wrong way? Can anyone suggest another way to carry out this task? Thanks
-
Cheers for that, but as it's not going to be paid for by work, it's not going to be paid for at all!
-
Hi, I'm trying to get a better grip on powershell and I can find loads of script archives but would love to try to understand what is going on. Can anyone suggest any books or websites that could walk me through powershell as a novice? Thanks
-
I have not seen this actually happen but some users are complaining that the HP LaserJet Pro 400 M401dn that they are using is missing off wither the first or last page on large print runs, around about 100 pages. Has anyone else had something similar? Could it maybe be a memory issue with the job being so large? Thanks
-
I didn't even consider using the ethernet sockets. I'm doing a review of rooms now!
-
FIXED!! I am currently trying to install classroombooking onto a 1and1 server as our linux box is starting to creak. I have set up the dbase and moved all files across but when I browse to the index.php i get 404 Page Not Found The page you requested was not found. Which is different from their 404 if the folder or file does not exist. I gave full 777 permision to it and then the whole foldr (just for testing) but still have the same result. Do you have any suggestions? FIXED!!! I was putting localhost as hostname but it needed to be the one provided by 1and1 in the mysql section.

